physics – I cannot migrate a simple example from cannon to cannon-es

I have a very simple TypeScript example in cannon that just print a gravity:

import "cannon";

function main()
    const physicsWorld = new CANNON.World();
    physicsWorld.gravity.set(0, -9.82, 0);
    console.log("gravity = ", physicsWorld.gravity);


You can run it on playground:

Source code on GitHub with cannon:
Source code on GitHub with cannon-es:

When I try to change “cannon” to “cannon-es”, for example, this line:

import "cannon"

on this line:

import * as CANNON from "cannon-es";

I get this error: Uncaught ReferenceError: exports is not defined and this error: Uncaught TypeError: Cannot read property 'World' of undefined