-
Notifications
You must be signed in to change notification settings - Fork 12k
polyfills-es5 doesn't check to see if promise is already added #14896
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
Comments
Hi, I am sorry but I am not understanding the issue here. It is expected that if you have |
@alan-agius4 We conditionally load zone.js.
With differential loading, this no longer prevents that error from showing up. |
I believe this issue is related: #14618 Also, we are currently fixing this with --es5BrowserSupport=false |
@alan-agius4 I updated the reproduction to remove your confusion. polyfills-es5 doesn't include zone and that's the only one you need to load again to trigger the error. |
The problem here is that when you import polyfills-es5 the first time, is promise will get polyfilled and zone will patch it, the second time you import this, the promise will get polyfilled again, which is not allowed to happen after zone has patched it. I’d say your use case is quite an edge case that users would import polyfills multiple times since this also introduces performance hits, such as extra code is downloaded and evaluated. My recommendation would be only to include the polyfills one time. This would fix the issue and also make your application more performance. I am assuming that the above error is being thrown because of potential bugs that may be caused when the polyfill is loaded after zone. Chiming in @JiaLiPassion since he is the zone.js guru. |
@alan-agius4 , thanks for digging into this issue, and @willyboy I will check this issue. |
@JiaLiPassion @willyboy |
Closing this issue as no further information has been provided by author. If the problem persists, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Yes
Yes, the previous version in which this bug was not present was: ....7.x
Description
We have a container app that loads Angular apps into it (the architecture is a nightmare).
The code looks like:
Prior to Angular 8 and differential loading, you could do this as many times as you wanted - I believe the polyfill that was used checked to see if promise was already polyfilled.
Post Angular 8, the second time you do this, you will see:
I'm guessing that the polyfills-es5 file assumes that it will only be loaded once and therefore doesn't make the same check to see if it's been polyfilled already.
(as a side note, when using $().html() on a script with "nomodule", the nomodule is ignored so this issue effects all browsers).
🔬 Minimal Reproduction
NOTE - You can reproduce this with es2015 by removing nomodule but it is simpler to reproduce in es5
🔥 Exception or Error
🌍 Your Environment
Anything else relevant?
The text was updated successfully, but these errors were encountered: