-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Global namespace pollution when using rollupOptions.output.format umd #17608
Comments
I haven't checked deeply but I guess we should use
|
This is what I was thinking too 👍 . I can work on a PR as soon as this is confirmed as a bug |
Yeah, I think it's a bug. |
Even with format=IIFE (at least for non-libs) it seems that some level of global namespace pollution occurs: |
We also ran into this issue today because the |
Describe the bug
I'm building a bundle with
umd
format as a target. When doing so I expect the result bundle to be wrapped in an iife function. The configuration looks like this :Instead, I have variables declared outside the
iife
:This is a problem because the variables' declaration might override previous variables with the same name. This is how I encountered the issue.
Workaround :
So far, I have used a homemade plugin to wrap my final code in a iife :
I'm willing to work on a PR. I believe the fix would be an extension of the #7948 so that is also applies when rollupOptions.output.format is
umd
oriife
.Reproduction
See steps
Steps to reproduce
umd
format as a targetdist/bundle.js
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: