esmin
Utility to minify code targeting ES2015+
Currently joins literals and tries to eliminate unreachable code, using babel to output without whitespace and comments..
Usage
Usage info is available with the -h
or --help
flags.
# basic usage esmin input.js -o input.min.js # to replace process.env.NODE_ENV with "production" add the `-p` flag esmin input.js -p -o input.min.js
Before and After
Here's an example that shows off what is currently implemented.
test.js
// hello world var m = 3*5*6*8 var b = +"234" var c = +"234" + 5 if 3*5*8 ? false : false else if true else if 3*5?4:6 < 5 if processenvNODE_ENV !== "production"
test.min.js
var m=720;var b=234;var c=239;;;