# Minimizing custom build bundle size

**URL:** <https://forum.babylonjs.com/t/minimizing-custom-build-bundle-size/60437>\
**Category:** Questions\
**Tags:** build\
**Created:** [September 10, 2025, 5:17am UTC](https://forum.babylonjs.com/t/minimizing-custom-build-bundle-size/60437 "2025-09-10T05:17:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vileyn0id](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@vileyn0id](https://forum.babylonjs.com/u/vileyn0id)\
**Post date:** [September 10, 2025, 5:17am UTC](https://forum.babylonjs.com/t/minimizing-custom-build-bundle-size/60437/1 "2025-09-10T05:17:59Z")

</div>

I’m trying to create a simple rotating logo that’ll sit on top of an html page. I was able to get the bundle size down to **1.5 MB** (357.75 KB gzipped), using webpack w/chunk splitting, but I wonder if it can’t be decreased further for a simple scene like this.

I’m certainly not a Node.js developer. Had some help from one, but we’re both new to babylon.js and this is as far as we’ve gotten.

[This is a draft of what I’m doing](https://int10h.org/dump/TEMPwgl/tmp.html), with everything I’ll be using in terms of code (design obviously not final).

For the build:  
[src/min-babylon.ts](https://pastebin.com/qR7cdUee)  
[package.json](https://pastebin.com/m7UJqcQ1) (tried a couple of other bundlers, but only the webpack stuff is relevant)  
[webpack.config.js](https://pastebin.com/6sXN34cJ)

Also, the [webpack bundle analyzer report](https://int10h.org/dump/TEMPwgl/webpack-report.html).  
One strange thing… without the chunk splitting, the single-file build is (1.8 MB). The current chunk splitting config produces some 33 chunks, but only 5 are actually used - those are the ones that add up to 1.5.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/2/5/256a459cb94071b737d964852c1faa1498027e55.png)

Any strategies I could pursue to make the thing smaller?  
You’ll notice that the scene itself is extremely simple - there aren’t even any lights (textures are emissive), etc.

---

<div class="post-metadata">

**Author:** ![phaselock](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@phaselock](https://forum.babylonjs.com/u/phaselock)\
**Post date:** [September 10, 2025, 6:31am UTC](https://forum.babylonjs.com/t/minimizing-custom-build-bundle-size/60437/2 "2025-09-10T06:31:10Z")

</div>

If you/partner are savvy and can move away from webpack. I recommend [Vite](https://vite.dev/) or [rolldown-Vite](https://vite.dev/guide/rolldown), both alr include rollup. I think for your use case, Vite should be sufficient. Rolldown version might be overkill. Bjs vite doc: [Babylon.js docs](https://doc.babylonjs.com/guidedLearning/usingVite/)

You can try this:  
a) clone your project to another directory, so your webpack version is untouched and acts as a fallback.  
b) install vite, integrate and build, compare the build result against yr webpack version. Even better if you can move to es6 and use [tree-shaking](https://doc.babylonjs.com/setup/frameworkPackages/es6Support/), import only what you need in bjs.

Hope it helps.
