EN
JavaScript - compress js files with terser (supports ES6+)
5 points
In this short article, we would like to show how to use terser
to compile js files to minified versions (*.min.js
).
Quick solution (run following command):
xxxxxxxxxx
1
cat input.js | npx terser --compress --mangle > output.min.js
Terser advantages:
- has support for ES6+,
- effective compression.
We can install terser
globally using:
xxxxxxxxxx
1
npm install -g terser