mydea / ember-indexeddb

Utilities & adapter to work with IndexedDB in ember & ember-data
https://mydea.github.io/ember-indexeddb/docs/
MIT License
17 stars 5 forks source link

Getting fatal Error in IE 11, attempt to replace Promise #7

Closed bummzack closed 6 years ago

bummzack commented 6 years ago

When I run:

beforeModel() {
  this._super(...arguments);
  return this.get('indexedDb').setup();
},

in my application route, I get the following error in IE 11

Cannot redefine non-configurable property 'Promise' TypeError: Cannot redefine non-configurable property 'Promise'

The error gets raised somewhere in the Ember internals, and is triggered by this line:

https://github.com/dfahlander/Dexie.js/blob/v2.0.4/src/Promise.js#L752

I'm unsure what is happening exactly, but my guess is that Ember/RSVP doesn't like that the Promise is being redefined within an ember promise? I don't have insight into the ember internals to make a better call. Maybe you can help? Did you get this addon to successfully work with IE 11?

I've also tried installing a promise polyfill, to no avail.

mydea commented 6 years ago

I just checked, and it works for me. What version of ember are you on? I just tried it with Ember@3.0.0, and everything worked as expected in IE11.

bummzack commented 6 years ago

Oh, that's interesting. I'm using Ember@3.2.1 Maybe it's another addon that's interfering somehow?

mydea commented 6 years ago

Can you give a full stack trace of the error, plus your package.json? Maybe this helps to track this down.

bummzack commented 6 years ago

It's quite a long list of dependencies. I've put the stacktrace and packages in a gist: https://gist.github.com/bummzack/f1c217d8c593593b1b20f9d190bb0e2a

I think I'll start with an empty project and add dependencies to see when/if the error occurs.

mydea commented 6 years ago

Hmm, yeah, that is a vey long list :D Hard to say what causes this.

Maybe you can try to find if something in your node_modules tries to set window.Promise... not exactly sure. Let me know if you find something out :)

bummzack commented 6 years ago

Yeah… it works as expected with a fresh app and only the indexeddb addon. I'll close this for now and post back if I find anything. Sorry for wasting your time.

bummzack commented 6 years ago

So, the offending module was this: https://github.com/kimroen/ember-cli-document-title

mydea commented 6 years ago

Hmm, weird. I can't really see where/how this addon would interact with promises :/

bummzack commented 6 years ago

I'm pretty sure it's this: https://github.com/kimroen/ember-cli-document-title/pull/74

mydea commented 6 years ago

Ah, that makes sense. OK, then we at least know what the origin is. Thanks for checking this out :)