-
-
Notifications
You must be signed in to change notification settings - Fork 1.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(html/minifier)/(ecma/minifier): bug with mangling #6455
Conversation
ac798b0
to
99dfa22
Compare
eeba640
to
79345a3
Compare
@@ -0,0 +1,5 @@ | |||
<!doctype html><html lang=en><title>Document</title><div>Script:</div> | |||
<script>/* Should mangle top level stuff */ var o=function(){let o="bar";o&&(o+="baz"),console.log(o)}</script> |
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.
Here another bug with printing comments - space between /* Should mangle top level stuff */
and var o
, we can should avoid it, because it increases size of bundle (I think this bug happens everywhere with comments), I will fix it in another PR
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!
swc-bump:
- swc_ecma_minifier
Description:
Here two things:
compressor
forscript
nodetopLevel
forProgram::Script
and keep top level stuff by default not mangledI have
For options I use:
swc_ecma_minifier::option::MinifyOptions::default()
After minification I have:
Yes, we keep
topLevel
, butfoo
is not manglingAlso if you use
You will get (only for
swc_ecma_ast::Program::Script
, but if I changed it onswc_ecma_ast::Program::Module
everything is fine):i.e.
top_level
is not respectedBREAKING CHANGE:
No
Related issue (if exists):
No