max123 Posted July 5, 2018 Share Posted July 5, 2018 Hi, I've just updated v3.0 to 3.2 and am getting this error: Uncaught ReferenceError: BABYLON is not defined. I'm using requirejs to load BJS, PEP and some other libs. Has something changed in 3.2 definitions? Quote Link to comment Share on other sites More sharing options...
RaananW Posted July 5, 2018 Share Posted July 5, 2018 3.2 has moved to UMD, and has a proper amd definition. you can now require babylonjs as a package. How did you load it until now? using externals? Quote Link to comment Share on other sites More sharing options...
max123 Posted July 5, 2018 Author Share Posted July 5, 2018 4 minutes ago, RaananW said: 3.2 has moved to UMD, and has a proper amd definition. you can now require babylonjs as a package. How did you load it until now? using externals? requirejs(["pep", "babylon", this.settingsFile]... Worked great... until now. Babylon is a small part of the project I'm working on and is loaded via requirejs at runtime when needed. Quote Link to comment Share on other sites More sharing options...
RaananW Posted July 5, 2018 Share Posted July 5, 2018 The package name is babylonjs (at least in the UMD definition). How does your configuration look like? babylon must be defined somewhere, if you load the file async Quote Link to comment Share on other sites More sharing options...
max123 Posted July 5, 2018 Author Share Posted July 5, 2018 @RaananW, it's defined in the main.js file like following: requirejs.config({ shim: { easeljs: { exports: 'createjs' }, tweenjs: { deps: ['easeljs'], exports: 'Tween' }, movieclip: { deps: ['easeljs', 'tweenjs'] }, babylon: { exports: "BABYLON" }, pep: { deps: ["babylon"] } }, paths: { createjs: 'libs/createjs-2015.11.26.min', "pdfjs-dist": "libs/pdf/pdfjs-dist", babylon: "libs/3d/babylon/babylon", pep: "libs/3d/babylon/pep", } }); Quote Link to comment Share on other sites More sharing options...
RaananW Posted July 5, 2018 Share Posted July 5, 2018 Babylon doesnt need the shim anymore, it has a proper amd definition. it will automatically populate the global namespace as a fallback, but requiring babylonjs (using this package name) will load it properly using requirejs max123 1 Quote Link to comment Share on other sites More sharing options...
max123 Posted July 5, 2018 Author Share Posted July 5, 2018 Hi @RaananW, thanks for the heads up. I've managed to load 3.2. Here's the requirejs definition (I did keep the shim as to make sure PEP is loaded and available to Babylon first): requirejs.config({ shim: { babylonjs: { exports: "BABYLON" }, pep: { deps: ["babylonjs"] } }, paths: { babylonjs: "libs/3d/babylon/babylon", pep: "libs/3d/babylon/pep", } }); Hop this helps to whoever has problems with BJS 3.2 and AMD (requirejs). Note: I've changed babylon to babylonjs. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.