-
-
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
fix(plugin-legacy): Remove and record polyfills in plugin post (fix #2786, #2781) #3023
fix(plugin-legacy): Remove and record polyfills in plugin post (fix #2786, #2781) #3023
Conversation
anyone please review this PR, a project of my company need this bugfix urgently. the same issue: |
@FrankFan (and others having the issue) It's very possible to workaround this issue until merged and released by using a local version of the plugin:
|
Another way would be to use https://www.npmjs.com/package/patch-package |
@TobiasMelen would you merge main to this PR? We changed the CI configs and it should pass after re-running. Thanks! |
063fccb
to
babd45a
Compare
Ok. I made a rebase mess, but think it's in correct state now. |
Any update on this? Can we have this PR merged? |
不生效 dev环境下 import还是报错 |
@yjwSurCode please open a new issue if there is still something that should be fixed in core |
|
@patak-js |
@yjwSurCode please use GitHub Discussions or join the chat at Vite Land to ask questions. |
@patak-js ok |
Why not answer? |
@yjwSurCode Because we don't really track closed/merged issues/prs |
Makes sure all polyfill ES imports are trimmed from legacy bundle by moving recording and removal from
Program:exit
topost
in plugin. This seems to ensure that@babel/preset-env
has found and added all polyfills from all nodes in chunk beforerecordAndRemovePolyfillBabelPlugin
processes.Fixes #2786 and #2781.
Additional context
I have not been able to create a test case for this. It's probably an api triggering
usage
polyfill import in a certain AST structure that causes the bug, but figuring out which seems hard. Instead the solution is tested by users experiencing the bug.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).