New step for loading BABYLON in WebWorker starting in v9.5.0

Hi Babylon.js team!

Starting in v9.5.0, I had to add a new step after importingBABYLON in a WebWorker:


worker.js (v9.4.1)

await import('https://cdn.babylonjs.com/v9.4.1/babylon.js');

console.log('BABYLON:', BABYLON); // BABYLON: Module {…}

// ✅ You can successfully call items in Babylon with BABYLON.___

worker.js (v9.5.0)

await import('https://cdn.babylonjs.com/v9.5.0/babylon.js');

console.log('BABYLON:', BABYLON); // BABYLON: {core: {…}, default: {…}, __esModule: true}

/*
	Expanding `core` and `default` objects in console log shows that they
share several items (if not the same object?).
Please see screenshot below.
*/

// ❌ You cannot call items in Babylon with BABYLON.___

globalThis.BABYLON = BABYLON.default; // new step needed in v9.5.0

// ✅ You can now successfully call items in Babylon with BABYLON.___

Screenshot of console log:


I was wondering if this should be the way to import going forward? Thank you for your help!

Interesting. let me check that. we did move to a different build system, but the result should be technically the same.

Thank you so much again, Raanan! :smile:

Resolved in v9.5.2! Thank you, Raanan! :smile: