mipodi
December 1, 2020, 2:31pm
1
Hi there! I created a basic app like so
Babylon light installation on github
The production build is roughly 3.3 MB, does this seem correct?
I also tried installing GitHub - RaananW/babylonjs-webpack-es6: Babylon.js basic scene with typescript, webpack, es6 modules, editorconfig, eslint, hot loading and more. Will even make coffee if you ask nicely.
The production build is roughly 23 MB, is this also correct?
I just want to make sure I’ve installed it correctly.
atmin
December 1, 2020, 2:54pm
2
You can reduce bundle size significantly by
npm install --save @babylonjs/core
(right now I see “babylonjs” in package.json/dependencies)
and import objects from that package, e.g. import { Scene } from '@babylonjs/core/scene';
1 Like
mipodi
December 2, 2020, 12:59pm
3
Thank you, I did that now and I got it down to this:
[webpack-cli] Compilation finished
asset index.js 818 KiB [emitted] [minimized] (name: main) 1 related asset
asset …/index.d.ts 45 bytes [compared for emit]
orphan modules 2.61 MiB [orphan] 176 modules
./src/index.ts + 176 modules 2.61 MiB [built] [code generated]
Does this look all right? (output from webpack)
atmin
December 2, 2020, 1:33pm
4
That looks alright to me. These 818KB should get gzipped in well under 300KB (you can try gzip -9 index.js
) on the wire.
Orphan modules is what webpack processed, but did not include in the bundle, because it’s not used.
1 Like