- try removing expose if you are exposing BABYLON in your config, and add this instead:
{test: /babylonjs\/babylon.js$/, loaders: ['exports?BABYLON']},
{test: /babylonjs\/babylon.canvas2d.js$/, loaders: [ 'imports?BABYLON=babylonjs/babylon']},
(the above is exposing the babylon library specifically to the canvas 2d lib, when it encounters the
import "babylonjs/babylon.canvas2d"
, statement below)
-
make sure you are not exposing BABYLON on the window.
-
I replaced all occurrences of
import BABYLON from 'babylonjs';
With:
import BABYLON from 'babylonjs/babylon';
(Not 100% sure the above is actually necessary, but burned entire night trying to fix and eventually got it working so didn't care to ask further questions)
- in your main js, or dependencies importing file, make sure to import babylon lib/Canvas2D once, i.e.
import "babylonjs/babylon";
import "babylonjs/babylon.canvas2d";