Crate swc_ecma_minifier

source ·
Expand description

JavaScript minifier implemented in rust.


Like other minification tools, swc minifier assumes some things about the input code.

  • TDZ violation does not exist.

In other words, TDZ violation will be ignored.

  • Acesssing top-level identifiers do not have side effects.

If you declare a variable on globalThis using a getter with side-effects, swc minifier will break it.


In debug build, if you set an environment variable SWC_CHECK to 1, the minifier will check the validity of the syntax using node --check

§Cargo features


If you enable this cargo feature and set the environment variable named SWC_RUN to 1, the minifier will validate the code using node before each step.