Languages
[Edit]
EN

JavaScript - compress js files with terser (supports ES6+)

5 points
Created by:
troya
692

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):

cat input.js | npx terser --compress --mangle > output.min.js

Terser advantages:

  • has support for ES6+,
  • effective compression.

 

Installation

We can install terser globally using:

npm install -g terser

 

References

  1. https://github.com/terser/terser

Alternative titles

  1. JavaScript - minify js files with terser (supports ES6+)
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Web resources compression / minify (JS, CSS)

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join