I have a problem that will hopefully be straightforward to solve. For a small project, I need to include cannon.js and the corresponding babylon plugin. For this project I am using webpack from the start. I installed everything through npm and then imported things this way:
import "cannon"; import CannonJSPlugin from "babylonjs"; import "@babylonjs/core/Physics/physicsEngineComponent";
(I am not very sure if that’s correct, probably CannonJSPlugin should also be in the @babylonjs/ tree somewhere, but I can’t find it…)
On the enablePhysics() line I get the following error in the browser console:
TypeError: babylonjs__WEBPACK_IMPORTED_MODULE_14___default.a is not a constructor
I suspect I am missing an import.
I really love the webpack interaction, but the documentation on package paths could definitely be improved (especially if this is in fact what’s causing this).
Thanks in advance!