-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ES7 Promise Finally on Microsoft Internet Explorer 11 and Microsoft Edge #8111
Comments
Hey @HyP3r-! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
Update to this issue: If I write this in the polyfill.js
it is working on Microsoft Internet Explorer 11 and not on Microsoft Edge and if I write this in the polyfill.js
it is working on the current version Microsoft Edge but not on Microsoft Internet Explorer 11. The reason for that is following: The Microsoft Internet Explorer 11 has no Fetch API and no Promise Object and the Microsoft Edge (or older Versions of the Mozilla Firefox or Google Chrome) has a Fetch API and a Promise Object but no finally function. So in the first case import "babel-polyfill" is polyfilling the Promise Object and import "core-js/modules/es7.promise.finally" is polyfilling the finally function on the new created Promise Object. Thats the reason why it is working on Microsoft Internet Explorer 11, but not on Microsoft Edge because the native Fetch API is returning a non polyfilled (native) Promise Object without the finally function. And in the second case import "core-js/modules/es7.promise.finally" is polyfilling on the existing Promise Object the finally function on Microsoft Edge and is unable to polyfill this functon on Microsoft Internet Explorer 11 because there is no Promise Object. So the Problem or Question is: why does import "babel-polyfill" Polyfill (overwrite) the Promsie Object even though it shouldn't do that in this case? |
Did this ever get resolved |
Encountered this problem on IE10/Edge, too. Had to use |
Maybe @zloirock would have any input on this? |
It's already explained in many other places. zloirock/core-js#371, zloirock/core-js#332, zloirock/core-js#178, etc. |
@HyP3r- This type of issue can be resolved via a variation of how C# implements extension methods. You can have a transform plugin which turns anything that looks like
In browsers that support the native method, performance will still be quite good. It just adds a wrapping function call and a simple In browsers that do not support the native method and need the polyfill, the type check in point 2 will almost never be the bottle-neck. The actual polyfill implementation itself will outweigh it. Ofcourse, even browsers that do support the native implementation could end up in point 2 when the method is called on the 'wrong type'. But still: that's the exception and not the norm. I'm currently using a homebrewen transform plugin that implements this pattern to solve the larger more general problem of polyfilling instance methods across |
Bug Report
Current Behavior
We want to support Microsoft Internet Explorer 11 and Microsoft Edge in out Project. In our Project we have used the ECMAScript 7 feature of Promise Finally a lot of times. In a talk with @existentialism he told me to use this little trick to make this thing working:
Expected behavior/code
This solution is working for Microsoft Internet Explorer 11 pretty good but does not work for Microsoft Edge:
How can I solve this problem?
Babel Configuration (.babelrc, package.json, cli command)
Environment
The text was updated successfully, but these errors were encountered: