inxs Posted January 17, 2018 Share Posted January 17, 2018 Hello guys, In our angular 4 application with webpack we are using the NPM package of babylonjs. After I ran the following lines of code ... npm run build-release-bundle-analyze and npm run bundle-report ... I realized that Babylon takes a lot of space of the total application size: How does it come that babylon.max.js is used inside a release bundle instead of the minified version? Can you in future seperate the "core" package of babylon even more so the "heavy" stuff, which some people may not need (we are not developing a game with bjs), can be left out? Regards and Thanks Johannes Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 17, 2018 Share Posted January 17, 2018 Hello we ship both so people can use the max.js to debug and bundle only the minified version for release You should not bundle both actually Pinging @RaananW Quote Link to comment Share on other sites More sharing options...
inxs Posted January 18, 2018 Author Share Posted January 18, 2018 Hello Deltakosh, thanks for your answer! We are using it the proper way as for example: import { Engine, Scene, ArcRotateCamera, AbstractMesh, Color4 } from 'babylonjs'; Webpack should automatically take the minified version by itself. It works for any other library except babylonjs. We are using stable Version 3.1.1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 18, 2018 Share Posted January 18, 2018 pinging @RaananW for more info Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 18, 2018 Share Posted January 18, 2018 Hi! The default file delivered is actually the max file which is unminified. the minified file is included in the package. The main file has always been the max file and this is why I haven't changed it. I can of course consider delivering the minified file as the main file, so when you import from "babylonjs" you automatically get the minified one. I will discuss it internally with the team and update here Starting 3.2.0-alpha0 (currently in alpha4) the directory structure of the npm package was changed, so if you use javascript (won't work in typescript due to the declaration file) you can do this: import * as BABYLON from 'babylonjs/babylon'; Or, of course, only load the files you need. this will load the minified file instead of the max file. A word of caution - as different modules reference "babylonjs" and not "babylonjs/babylon" you might include both if you use GUI (for example). Just as a general question (and really - only our of curiosity) - why don't you add minification to the build process? a simple webpack plugin and you have everything minified as you wish. Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 18, 2018 Share Posted January 18, 2018 Ok! Starting next npm package (presumably 3.2.0-alpha5) you will have the minified file instead of the max file as the main file. so "babylonjs" will work as you expect it to. Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 18, 2018 Share Posted January 18, 2018 @inxs, regarding your first question - yes, the plan is to actually deliver modules. Our main problem are internal dependencies in main classes like the scene and engine, that shouldn't change. I am working on a solution for this that will be released with the final 3.2 (and hopefully sooner). So you could load modules and not the entire framework every time. Quote Link to comment Share on other sites More sharing options...
inxs Posted January 19, 2018 Author Share Posted January 19, 2018 Hello @RaananW, thanks for your detailed answer. We using Angulgar CLI for our builds, so we dont have influence on which file it is using But I think we will wait ultil 3.2.0 is release and then we will use the benefits of the modules! Im looking forward to it! 3.1.1 made a giant leap in performance from my perspective. Babylon is getting better every day! RaananW and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 19, 2018 Share Posted January 19, 2018 And 3.2 will also improve performances again Quote Link to comment Share on other sites More sharing options...
gsanta Posted May 2, 2019 Share Posted May 2, 2019 Hi I would like to ask about the state of this modularization approach. Is it still under development? For me even the minified version (with 2mb size) seems to be huge especially for mobile. Quote Link to comment Share on other sites More sharing options...
Guest Posted June 14, 2019 Share Posted June 14, 2019 We have a new forum: forum.babylonjs.com 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.