Skip to content

Instantly share code, notes, and snippets.

@jasonayre
Created June 2, 2017 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonayre/69e71e2c1b7cafe8333f9b68906c4671 to your computer and use it in GitHub Desktop.
Save jasonayre/69e71e2c1b7cafe8333f9b68906c4671 to your computer and use it in GitHub Desktop.
babylon_3_0_upgrade_webpack_fix_steps
  1. 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)

  1. make sure you are not exposing BABYLON on the window.

  2. 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)

  1. 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";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment