Significant increase in @babylonjs/gui package size between 5.5.0 and 5.6.0

My side project using Babylon.js increased in final bundle size between 1.88MB to 2.07MB recently. I’ve narrowed it down to the @babylonjs/gui module.

With 5.5.0:

asset bundle.js 1.88 MiB [emitted] [minimized] [big] (name: main)
asset index.html 211 bytes [compared for emit]
orphan modules 2.11 MiB [orphan] 262 modules
runtime modules 937 bytes 4 modules
cacheable modules 4.92 MiB
  modules by path ../app/node_modules/ 4.7 MiB
    modules by path ../app/node_modules/@babylonjs/core/ 3.45 MiB 105 modules
    modules by path ../app/node_modules/@babylonjs/gui/ 1.23 MiB
      modules by path ../app/node_modules/@babylonjs/gui/2D/controls/*.js 191 KiB 7 modules
      modules by path ../app/node_modules/@babylonjs/gui/2D/*.js 97.9 KiB 5 modules
      ../app/node_modules/@babylonjs/gui/index.js + 99 modules 976 KiB [built] [code generated]

With 5.6.0 or newer:

asset bundle.js 2.07 MiB [emitted] [minimized] [big] (name: main)
asset index.html 211 bytes [compared for emit]
orphan modules 2.59 MiB [orphan] 302 modules
runtime modules 937 bytes 4 modules
cacheable modules 5.42 MiB
  modules by path ../app/node_modules/ 5.21 MiB
    modules by path ../app/node_modules/@babylonjs/core/ 3.45 MiB 111 modules
    modules by path ../app/node_modules/@babylonjs/gui/ 1.74 MiB
      modules by path ../app/node_modules/@babylonjs/gui/2D/controls/*.js 191 KiB 7 modules
      modules by path ../app/node_modules/@babylonjs/gui/2D/*.js 97.9 KiB
        ../app/node_modules/@babylonjs/gui/2D/advancedDynamicTexture.js + 4 modules 74.1 KiB [built] [code generated]
        + 4 modules
      ../app/node_modules/@babylonjs/gui/index.js + 144 modules 1.46 MiB [built] [code generated]

Any ideas?

@RaananW figured out that I had a bad import in one of my files that caused tree shaking to not work for the gui package. Fixing that fixed the size increase and reduced my overall package size by 500k. Not sure why there is a size increase from 5.5.0 to 5.6.0 but it doesn’t matter anymore. :slight_smile:

2 Likes