-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Minifier does not respect toplevel: false #6418
Comments
Seems like this is an issue of |
@alexander-akait |
Sorry, didn't test it right away and now see that issue isn't solved by Alexander's PR :( @kdy1, would you reopen ticket, please? |
No, please file a new one instead |
Oh nevermind |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Describe the bug
Different behaviour between online playground and real tool. Also, swc mangles top level global variable :(
Input code
Config
Playground link
https://play.swc.rs/?version=1.3.15&code=H4sIAAAAAAAAA1MqLU5VKC4pykwuUbLmKkssUkjLz1ewVUgrzUsuyczPU9DQVKhWqAUAf4u9HCcAAAA%3D&config=H4sIAAAAAAAAA22PSw7CMAxE7%2BJ1F7AAod6BMyArTKpAPlYcEFXVu5NCP0Ji5dG8sTUe6KaG2oGEsyJPSvtY%2BEUtwQRWk50UamqsWpa9YmyocO5QpogeKvMpKWbaUHDR2X66ZFKQDNUNcew8JlSSeDzhV3QH5GI8q0YO0F%2Ff%2FvEkuycX1JlkQw6nVStbzm6%2FW3qPtXlI18fcoBd8PjjSuJVezuh5Dn5X39hJ70MnAQAA
Expected behavior
var foo=function foo(){};
Actual behavior
var n=function n(){};
Version
1.3.15
Additional context
Online playground shows everything right. But when I copy config from playground to .swcrc file and execute cli tool (
npx swc 'in.js' --config-file=.swcrc --out-file='out.js'
) its returns different (and wrong) code.We have some projects with dependencies like
https://github.com/ganlanyuan/tiny-slider/blob/master/dist/min/tiny-slider.js
and this behaviour is blocking us from upgrade from babel/terser to swc :(Now its working correct only with fully disabled
mangle
The text was updated successfully, but these errors were encountered: