Packing and Shipping

Just bundle them together!

Packaging Babylon.js was always an interesting task for the team. In the early days of the framework the common way of consuming a JavaScript framework was to load it in a script tag in your HTML and populate a global namespace (usually on the window object). This is how all major frameworks used to work — and probably still do. The most known example was (and I guess still is?) jQuery, that was always available using the `$` variable(and the jQuery object, of course). So — load the script, have it do its magic in your browser, and get the set of tools with which you can work.

AMD, CommonJS, npm and everything in between.

Then along comes ES6

What should you use?

Well, as always, that depends. UMD is still faster for rapid prototyping. The Babylon.js playground, for example, still uses the UMD packages (and the global BABYLON namespace). On the other hand, if you start a new project and want to bring a bit of structure, better architecture and smaller package size, I always recommend ES6.

Example please!

My favorite stack (and I know this is a very personal) is:

  • Webpack — IMO the most flexible bundler at the moment.
  • TypeScript — such a wonderful frontend language!

The future?

There is always room for improvements. The technology keeps on progressing, and we have to progress with it as well. And though Dolores Umbridge (and we always listen to Dolores) once said “Progress for the sake of progress must be discouraged”, sometimes you need to stay ahead, otherwise you will be left behind. If the framework cannot be consumed, we must fix it. If there is a better way of doing things, we can investigate and see if we can support it. Of course while keeping the framework backwards compatible and highly performant. Good luck with that!

Babylon.js: Powerful, Beautiful, Simple, Open — Web-Based 3D At Its Best.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store