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);
}

main();

You can run it on playground: https://plnkr.co/edit/EoxKFFYZgtXnTTEX?preview

Source code on GitHub with cannon: https://github.com/8Observer8/hello-cannon-ts
Source code on GitHub with cannon-es: https://github.com/8Observer8/hello-cannon-es-ts

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

image