Serving babylon script files locally

I am new to Babylon.js and working on a prototype proposal. The question has come up whether the source Babylon.js files can be hosted on the client’s server vs directly? Essentially, is there any reason why we can not or should not download and self-host the following files which are referenced in the script?

https ://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js
https ://preview.babylonjs.com/ammo.js
https ://preview.babylonjs.com/cannon.js
https ://preview.babylonjs.com/Oimo.js
https ://preview.babylonjs.com/earcut.min.js
https ://preview.babylonjs.com/babylon.js
https ://preview.babylonjs.com/materialsLibrary/babylonjs.materials.min.js
https ://preview.babylonjs.com/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js
https ://preview.babylonjs.com/postProcessesLibrary/babylonjs.postProcess.min.js
https ://preview.babylonjs.com/loaders/babylonjs.loaders.js
https ://preview.babylonjs.com/serializers/babylonjs.serializers.min.js
https ://preview.babylonjs.com/gui/babylon.gui.min.js
https ://preview.babylonjs.com/inspector/babylon.inspector.bundle.js

Also, are there any rules regarding the loading animation or lack thereof?

I engaged a developer for this rushed prototype project once-off and would ask him, but if the proposal is accepted, I may look for a developer better-suited to a longer term project relationship.

It’s Apache 2.0 which is very liberal.

And you can turn off the loading animation if you want (or replace it)

For production use, e.g. publishing your scene for others, it actually is beneficial to use the CDN versions, which will get from a server close to them. Also, there is some benefit if many people did this, in that other pages may have already loaded them.

That said, unless you are doing something that is not yet available in the last release, 4.2, using preview, 5.0 currently, does not have as many advantages, as well has some potential for a problem with the changed code. Replacing ‘preview’ with ‘cdn’ will get you 4.2. Also, preview changes every day or so. Good for dev, but not efficient.

1 Like