You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SWC's minifier does not remove unused classes in some cases. For example, a class with a static member that is the result of a function without side-effects.
Isn't the passes property supposed to allow all of the layers to run multiple times? It's strange that that setting has no effect compared to running the minifier on its own output.
When using swc to minify code in webpack, although most of the time we get better results (and it is a lot faster), we've encountered a number of chunks where a ton of dead code is left over after minification. This is because webpack leaves unused exports present but unexported and relies on the minifier to perform DCE.
Describe the bug
SWC's minifier does not remove unused classes in some cases. For example, a class with a static member that is the result of a function without side-effects.
Input code
Config
Link to the code that reproduces this issue
https://github.com/iclanton/swc-minification-issue
SWC Info output
Expected behavior
The
Bar
class is removed. This is the output from feeding the same code into Terser:Actual behavior
The minification output of that input code is:
Note that feeding this output into SWC's minifier again, its output matches Terser's output.
Version
1.11.24
Additional context
No response
The text was updated successfully, but these errors were encountered: