aurelia / polyfills

The minimal set of polyfills needed to run Aurelia.
MIT License
26 stars 27 forks source link

aurelia-polyfills appears to conflict with babel-polyfill in IE 11 #31

Closed jhoguet closed 8 years ago

jhoguet commented 8 years ago

I'm submitting a bug report

Current behavior: When one script on the page uses aurelia-polyfills, and another script on the page uses babel-polyfill, in IE11, we get a stack overflow.

Expected/desired behavior: no stack overflow :)

I created a gist (https://gist.run/?id=e76b87bb489b676358e27e80fc10be80) but it appears gist.run doesn't work in IE11 and it has other unrelated errors in the chrome console.

I did create a repo that easily demonstrates the issue https://github.com/jhoguet/babel-polyfill-test/tree/master. I recommend reading the readme as it has a bit more info along with links to relevant source code.

Please Help Have you guys seen this? Can you help me triage where this is going wrong? Are you sure it is safe to assume that Collection wasn't extended by anyone?

appreciate your help... at this point we have several hour across 2 different teams in order to peel away all of our own complexity and isolate this down to something simple to reproduce - hope it helps you guys see something obvious!

jhoguet commented 8 years ago

I have done a little bit more digging and found the following:

At this point, it seems like the Aurelia Map constructor check is brittle, even if I can get babel-polyfill to not touch the constructor (eg add support for Iterable to Aurelia Map), what is to stop some polyfill in the future from monkey patching it causing this to break again?

Am I missing something? thoughts?

jhoguet commented 8 years ago

just asked for help on Gitter image

gheoan commented 8 years ago

What happens if you import core-js first and then aurelia-polyfills?

jhoguet commented 8 years ago

it will work because it uses core-js's Map polyfill instead of aurelia's

EisenbergEffect commented 8 years ago

Definitely import core-js first. If you want, you can even remap aurelia's polyfills to your own custom emtpy module to avoid the size.

jhoguet commented 8 years ago

This will continue to be an issue for anyone using aurelia-polyfills if there is also another bundle on the page using core-js.

In our case, the 2 independent bundles are both loaded asynchronously causing this to be intermittent. (If the bundle that contains aurelia-polyfills loads first, the brittle constructor check discussed in https://github.com/aurelia/polyfills/issues/31#issuecomment-234742718 breaks core-js).

I probably didn't do a good enough job describing it - let me know if you closed it with an incomplete understanding and want me to explain further.

EisenbergEffect commented 8 years ago

If you need an alternative fix, then please submit a PR.