-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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 legacy chunks in IIFE (IE11) #2972
Conversation
template literals in our legacy chunks got randomly overwritten (gql mixed with emotion) in legacy build the problem was that at the top of the file there were `var lit1, lit2, lit3` declarations and those were evaluated in global scope this resolves the issue
renamed commit to fit standards, no other change |
@@ -260,7 +260,7 @@ function viteLegacyPlugin(options = {}) { | |||
] | |||
}) | |||
|
|||
return { code, map } | |||
return { code: `;(function(){${code}})();`, map } |
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.
@cztomsik shouldn't the sourcemap (map
) be also updated? Using magic-string for example
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.
good point but I'm busy now so maybe later or somebody else can fix it properly, this is just what worked for us
Thanks for the PR, closing this one as #3783 was merged now. |
No worries, thanks @umidbekk for fixing it :) |
Description
template literals in our legacy chunks got randomly overwritten (gql mixed with emotion) in legacy build
the problem was that at the top of the file there were
var lit1, lit2, lit3
declarations and those were evaluated in global scope. this resolves the issueAdditional context
I was surprised that systemjs does not wrap files in IIFE itself
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).