Cilshell Posted September 11, 2017 Share Posted September 11, 2017 Hello, How can I use Babylon's extensions with NPM imports (es6 style)? To resume my problem: 1. I use NPM and Webpack for my project. To use Babylon I've install the node module babylonjs and I import the lib with the line: import BABYLON from 'babylonjs' 2. I would like use too the Sky extension https://doc.babylonjs.com/extensions/sky To do that I try to import it with the line: import {skyMaterial} from 'babylonjs/dist/preview release/materialsLibrary/babylon.skyMaterial.min.js' 3. The compilation is done but in my Browser I've an error : Uncaught ReferenceError: __extends is not defined at eval (webpack-internal:///36:1) at BABYLON (webpack-internal:///36:1) at eval (webpack-internal:///36:1) at Object.<anonymous> (app.js:951) at __webpack_require__ (app.js:660) at fn (app.js:86) at eval (webpack-internal:///29:7) at Object.<anonymous> (app.js:904) at __webpack_require__ (app.js:660) at fn (app.js:86) I've forgot something or it's the wrong way? Quote Link to comment Share on other sites More sharing options...
Hersir Posted September 11, 2017 Share Posted September 11, 2017 @CilshellIts known issue Git issue Quote Link to comment Share on other sites More sharing options...
Cilshell Posted September 11, 2017 Author Share Posted September 11, 2017 15 minutes ago, Hersir said: @CilshellIts known issue Git issue Are you sure ? This thread is about "included extensions do not work when BABYLON is imported". But for my case only the extension causes trouble and I use ES6 and not Typescript. Do you know the good way to add extensions? Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 11, 2017 Share Posted September 11, 2017 Hi all, I am currently working on changing the framework's structure. Afterwards, you would be able to use the npm package in order to load / import that parts of the framework you need, or simply import * from babylon. It will take a bit of time, as I am trying to keep everything backwards compatible while advancing to the future. Please be patient for another week or two. Quote Link to comment Share on other sites More sharing options...
Cilshell Posted September 11, 2017 Author Share Posted September 11, 2017 19 minutes ago, RaananW said: Hi all, I am currently working on changing the framework's structure. Afterwards, you would be able to use the npm package in order to load / import that parts of the framework you need, or simply import * from babylon. It will take a bit of time, as I am trying to keep everything backwards compatible while advancing to the future. Please be patient for another week or two. Thank you very much @RaananW , Do you know a temporary solution like CDN for extensions? Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 11, 2017 Share Posted September 11, 2017 Manually adding export = BABYLON; at the end of babylon.d.ts will allow you to do: import * as BABYLON from 'babylonjs'; But this is not a very good solution Quote Link to comment Share on other sites More sharing options...
Cilshell Posted September 11, 2017 Author Share Posted September 11, 2017 Ho, I must use Typescript. I worked only with js files until now. When I import: import BABYLON from 'babylonjs' I thinked it's import the js file "dist/preview release/babylon.max.js" Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 11, 2017 Share Posted September 11, 2017 The export at the end of the js file might have been changed. I have to check. But it might take some time... Quote Link to comment Share on other sites More sharing options...
Cilshell Posted September 11, 2017 Author Share Posted September 11, 2017 Ho, ok, don't check. I will found another solution waiting the changes of the framework structure :-) 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.