IE11 'Promise' is not defined

I know that IE11 is an old monster and nobody should use it but at the end of the day there are some people playing with it yet.

I’ve tried to call some scripts like
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>

before including the Babylon scripts but without luck.

Anyway shouldn’t Babylon manage this without any additional code?

Thank you in advance!

Promise is already handled by babylon.js:

Here is my minimal reproducible example:
http://www.motivacg.com/temporal/babylonbug/indexbug.html

(you’ll need internet explorer 11)

Gotcha! This is because of the Draco compressor which is using WebWorker (where the promise polyfill is not supported)

Let me ask @bghgary to see if we can disable webworkers for Draco decompression

That’s a bummer. I wonder if we can load our promise polyfill in the web worker. For now, you can disable Draco compression from running in a web worker by doing something like this:

BABYLON.DracoCompression.DefaultNumWorkers = 0;

unfortunately, after using DefaultNumWorkers = 0, now it triggers:

BJS - [09:37:38]: Unable to load from ./mesh.glb: /meshes/0/primitives/0: undefined

www.motivacg.com/temporal/babylonbug/indexbug2.html

I guess any polyfill with self reference instead of window will do (for example promise-polyfill/polyfill.js at master · taylorhakes/promise-polyfill · GitHub) .
Adding this kind of global object detection method (self->window->global) to the PromisePolyfill.Apply method (in BJS) will allow you to use this polyfill in webworkers as well (not tested, just a thought :slight_smile: )

1 Like

I was getting that error before I suggested the DefaultNumWorkers, so unless you added that before I posted the reply, then it’s probably unrelated.