Replies: 1 comment 1 reply
-
Not sure about 1 or 2, but 3 is definitely true |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
swc minifier analyzes the relation between variables, functions, and all declarations, and then it aborts if it cannot prove that it’s safe to optimize. This is correct, but requires lots of time and decreases the compression rate.
This is fine IMO, but I recently found that terser is not verifying it fully. I didn’t know it because I didn’t look at the compressor code of
terser
, but while reviewing a PR, @Austaras told me thatterser
simply assumes that function declarations are not modified by side-effects of expressions.Related code: https://github.com/terser/terser/blob/4255fb3063ce1b41a5d5c9c48df443b5df0e797e/lib/compress/tighten-body.js#L887
There are some more similar assumptions.
terser
intentionally assumesI think we should collect these assumptions and write them on the documentation
Beta Was this translation helpful? Give feedback.
All reactions