Es6 Tree shaking experience

Hello there,

I did a conversion of the code to go to full ES6.
I went from 2.6 (or 2.8) to 1.54 Mb which is already pretty cool :).

Here is a few things I had to find to make everything work.
Each time I had to import something was because of a console hint. It was not that difficult by just looking for the function into the code but sometimes you have an error because another thing didn’t load so the advertised error wasn’t always responsible for the hickup :).

In our global Loader I had to import these :
import ‘@babylonjs/core/Loading/Plugins/babylonFileLoader’ import ‘@babylonjs/core/Physics/physicsEngineComponent’ //Not sure why I didn’t think I was using physics
import ‘@babylonjs/core/Loading/loadingScreen’

To make the DefaultRenderingPipeline work I had to import this
import '@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent'

To make the MotionBlurPostProcess work I had to import this
import '@babylonjs/core/Rendering/geometryBufferRendererSceneComponent'

To make the GlowLayer work I had to import this
import '@babylonjs/core/Layers/effectLayerSceneComponent'

To enable the scene.beginAnimation I had to import this
import '@babylonjs/core/Animations/animatable'

That’s all for now.
I hope this will help for some debug :slight_smile:

2 Likes

Sweet, glad to see file size shrink. Thanks for reporting. I can update the code to add error messages saying what include is missing so it will be easier for others in the future.

Thanks a ton, this will help either adding the error message or merging components to automatically do it.

This will improve a lot the final drop in 4.0

Glad this will help !