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: https://github.com/8Observer8/hello-cannon-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](https://user-images.githubusercontent.com/3908473/131516723-3b25b833-0fe6-40f6-90a4-52c89db76ef0.png)