1141 releases (191 breaking)

new 0.192.9 Feb 25, 2024
0.191.9 Feb 4, 2024
0.190.8 Dec 29, 2023
0.189.73 Nov 29, 2023
0.16.1 Jul 31, 2021

#2413 in Web programming

Download history 6979/week @ 2023-11-05 7136/week @ 2023-11-12 6616/week @ 2023-11-19 9158/week @ 2023-11-26 6311/week @ 2023-12-03 5416/week @ 2023-12-10 3613/week @ 2023-12-17 5123/week @ 2023-12-24 5641/week @ 2023-12-31 5291/week @ 2024-01-07 6544/week @ 2024-01-14 7757/week @ 2024-01-21 6173/week @ 2024-01-28 3564/week @ 2024-02-04 6503/week @ 2024-02-11 25700/week @ 2024-02-18

42,895 downloads per month
Used in 43 crates (13 directly)


93K 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.


~274K SLoC