Using Closure Compiler to compile BabylonJS

BabylonJS is a

  • Large library.
  • Statically typed in typescript
  • Tree shakeable using es6 modules

For a small scene, using microbuild, I got a brotli compression bundle of 144kb. Before es6 modules were introduced in BabylonJS and before I used microbundle, I had bundles that were over 2mbs.

In my experience, using closure-compiler could reduce this bundle by an additional 20%. However, setting up closure-compiler is a pain! Has anyone tried to transpile BabylonJS Typescript to tsickle to closure-compiler with ADVANCED_OPTIMIZATIONS turn on. I have no idea if the static typing is good enough in BabylonJS; however, getting a library like BabylonJS for just over 100k would be amazing.

1 Like

Hello and welcome!

Glad that you like our module work :slight_smile:

Adding @Sebavan who worked on our es6 port to see if he has some knowledge of closure

1 Like


This is an amazing feedback I love both Microbundle and Tsickle from what I have read about them. Unfortunately, I never found the time to try out Tsickle on Babylon so far.

If you find any blocker in our codes or typings I ll be happy trying to solve them as it would be a great addition to the framework :slight_smile:

Do not hesitate would you need anything.

1 Like