Packing project for production

Good day BabylonJS community,
I have a question regarding packing project for production.
I’ve already made few projects for production using babylonJS,
The size of the bundle I’ve generated throughout my experience using
webpack or parcel bundler were roughly around 8-10Mb.
Is there any way I could make my application lighter in production?
And if there is, can anyone show me a guiding material concerning that topic.
I’ve been searching for it and could not find any step by step guide.

Thank you in advance.

Do you mean size of all js folder?
Could you give a screenshot of files what you have in this folder?
I believe if you disable sourcemaps the total size will be much smaller.
Also, if you are using Inspector it may add to total size (one may use dynamic import to avoid it).

I mean just the size of main.js, the bundle that contains all the libraries needed for babylonJS to work.
I feel like I’m doing something wrong since other demo babylonjs projects need less size to operate than mine.

Is it possible to share your code to have a look at?


Actually I meant the whole code, not just a bundle :slight_smile:

apologies, can you check again?

@RaananW has been working on code restructuring that will allow the package size to be even smaller, and he may have useful pointers for you :smiley:

1 Like

Can obfuscation be an option?

If by obfuscation you mean minimization, then yes, minimization can be used to reduce the bundle size (and is already done on the babylon bundle as far as I know). But other obfuscation techniques in general can increase the code size, as their main objective is making the code harder to read, not smaller :slight_smile:

1 Like