-
-
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): wrap chunks in IIFE #3783
Conversation
I think we would need to keep the map from babel, and that's why the original PR get blocked since MagicString does not take source map input, while I am not familiar with babel transforming to support sourcemap |
@antfu thanks for the quick review! I've changed implementation to use babel plugin for transformations, so source map behavior should not change |
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.
Thanks!
@antfu @patak-js sorry if I'm being annoying, but is there any release plan for that fix? |
We'll do a release on Monday or Tuesday including this fix |
@umidbekk |
Description
Solving the same problem as #2972, but contains tests and source map support (sorry for the duplicate, but original PR is not changed since the April and this bug block migration of the large codebase from the CRA to Vite).
If someone comes from google, it solves global scope pollution issues like:
Can't create duplicate variable: '_excludes'
,redeclaration of const _excludes
orIdentifier '_excludes' has already been declared
errors caused by@babel/plugin-desctructuring
(example)Issues with
styled-components
oremotion
caused by@babel/plugin-transform-template-literals
(example)What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).