Babylonjs without an internet connection

Hi, recently I made a React App with BabylonJS and wrapped it using Electron. This worked great and everything seemed ok until I tried to use the wrapped app on a device without an internet connection.

I got around the error my manually adding basisTranscoder, glslang, twgsl, babylon.ktx2Decoder, draco_decoder_gltf, draco_wasm_wrapper_gltf, gltf_validator and meshopt_decoder to the app and then changing the URLs in the built JavaScript.

Is there a way to use BabylonJS that will work offline once built, it’s possible I’ve missed something but I’ve had a quick google and couldn’t see anything too helpful.

Thanks for your help :blush:

The short answer is yes you can. A longer answer is some features require more than the core babylon.js. For example, if you are importing assets you will need the loader script downloaded and for browser security issues and CORS compliance you will need to use a local server .

Framework Versions | Babylon.js Documentation.

If you are having issues running it offline then it would be useful to know what errors you are getting in the console.

Hello just checking in, was your question answered? @link2twenty

Sort of :sweat_smile:
I was hoping for a slightly simpler solution but this works.

Thank you.

1 Like

I now realise my question was poorly written, the answer I was looking for (though didn’t know it) was that I could update the draco comression urls and point them somewhere local.

DracoCompression.Configuration.decoder.wasmUrl = "./babylonjs/draco_wasm_wrapper_gltf.js";
DracoCompression.Configuration.decoder.wasmBinaryUrl = "./babylonjs/draco_decoder_gltf.wasm";
DracoCompression.Configuration.decoder.fallbackUrl = "./babylonjs/draco_decoder_gltf.js";

Thanks :grin: