-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
feat(plugin-legacy): support additionalModernPolyfills
#16514
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Can you explain what you mean when you say the existing docs are untrue? Why and in what case does importing polyfills in your source code not work? |
Per the referenced issue, if you import a side-effectful module and you have chunking (e.g. in MPA mode), there’s no guarantee that it will run before other code that relies on that side effect to have executed. |
#5142 is about the bug in dev in prebundled dependencies. I think this issue is different? But putting that issue aside and using the same arguments as the current |
It might be rollup/rollup#3888 that I ran into (which also references #5142). But thanks for approving the PR, can’t wait to try it out 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could merge this one without going through a team meeting. It seems a non-controversial addition.
@bluwy apologies for the direct ping, but when do you expect to publish a new version? |
I think as soon as after #16566 is merged, which is also plugin-legacy related. |
I've published 5.4.0 as the other PR needs additional work than expected. |
Thank you so much, @bluwy! |
Description
This PR introduces
additionalModernPolyfills
option that mirrors the existingadditionalLegacyPolyfills
option.The reason this is needed for the modern chunk is because due to #5142 the following is not actually true, and the only way to ensure polyfills are loaded before application code is to use
plugin-legacy
:For example, this option can be used when an application only configures
modernPolyfills
but wishes to add custom polyfills for non-legacy browsers.