700 releases (165 breaking)

Uses new Rust 2021

new 0.166.3 Jan 27, 2023
0.165.4 Jan 24, 2023
0.160.28 Dec 21, 2022
0.160.1 Nov 30, 2022
0.16.1 Jul 31, 2021

#696 in Web programming

Download history 6551/week @ 2022-10-07 7343/week @ 2022-10-14 8555/week @ 2022-10-21 6539/week @ 2022-10-28 3773/week @ 2022-11-04 3257/week @ 2022-11-11 3602/week @ 2022-11-18 2269/week @ 2022-11-25 3208/week @ 2022-12-02 4570/week @ 2022-12-09 3241/week @ 2022-12-16 1191/week @ 2022-12-23 2297/week @ 2022-12-30 4782/week @ 2023-01-06 5197/week @ 2023-01-13 4557/week @ 2023-01-20

17,003 downloads per month
Used in 31 crates (9 directly)


89K SLoC


EcmaScript minifier for the SWC project. This is basically a port of terser.


Currently name mangler is very simple. To focus on creating a MVP, I (kdy1) will use simple logic for name mangler and implement the content-aware name mangler after publishing first non-beta version.

Debugging tips

If the output contains variables named e, t, n it typically means the original library is published in a minified form and the input contains eval. The current swc name mangler does not do anything if eval is used.

Profiling the minifier

From mac os x, run

./scripts/instrument/all.sh path/to/input/dir


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.


~321K SLoC