Open1
JavaScriptを手元でMinifierしたい

JavaScriptの難読化、サイズ圧縮
-
https://syncer.jp/js-minifier
などを使いWebツールでやっても良いが、やはり手元でやりたい。
terser
対応馬
- UglifyJS
https://github.com/mishoo/UglifyJS
→ こちらはES6+をサポートしなくなる?みたい。
なので、terserを使ってみる
インストール
npm install terser -g
Usage
terser index.js --compress --mangle --output compressed.js
or
# 最後に元ファイルの手前にオプションを指定する場合は、-- で区切る
terser --compress --mangle --output compressed.js -- index.js