babel-minify(1)

ES6+ aware minifier based on the Babel toolchain

Section 1 babel-minify bookworm source

Description

BABEL-MINIFY

NAME

babel-minify - ES6+ aware minifier based on the Babel toolchain

DESCRIPTION

Usage: minify index.js [options]

IO Options:

--out-file, -o

Output to a specific file

--out-dir, -d

Output to a specific directory

Parser/Generator options

--sourceType

Indicate the mode the code should be parsed in. Valid options are "script" | "module" | "unambiguous"

--comments

Enable/Disable comments in the output. For more specific control, use the Node API

Transform Options:

--mangle

Context and scope aware variable renaming

--simplify

Simplifies code for minification by reducing statements into expressions

--booleans

Transform boolean literals into !0 for true and !1 for false

--builtIns

Minify standard built-in objects

--consecutiveAdds

Inlines consecutive property assignments, array pushes, etc.

--deadcode

Inlines bindings and tries to evaluate expressions.

--evaluate

Tries to evaluate expressions and inline the result. Deals with numbers and strings

--flipComparisons

Optimize code for repetition-based compression algorithms such as gzip.

--infinity

Minify Infinity to 1/0

--memberExpressions

Convert valid member expression property literals into plain identifiers

--mergeVars

Merge sibling variables into single variable declaration

--numericLiterals

Shortening of numeric literals via scientific notation

--propertyLiterals

Transform valid identifier property key literals into identifiers

--regexpConstructors

Change RegExp constructors into literals

--removeConsole

Removes all console.* calls

--removeDebugger

Removes all debugger statements

--removeUndefined

Removes rval’s for variable assignments, return arguments from functions that evaluate to undefined

--replace

Replaces matching nodes in the tree with a given replacement node

--simplifyComparisons

Convert === and !== to == and != if their types are inferred to be the same

--typeConstructors

Minify constructors to equivalent version

--undefinedToVoid

Transforms undefined into void 0

Other Options:

--keepFnName

Preserve Function Name (useful for code depending on fn.name)

--keepClassName

Preserve Class Name (useful for code depending on c.name)

--keepFnArgs

Don’t remove unused fn arguments (useful for code depending on fn.length)

--tdz

Detect usages of variables in the Temporal Dead Zone

Nested Options:

To use nested options (plugin specfic options) simply use the pattern --pluginName.featureName.

For example, minify index.js --mangle.keepClassName --deadcode.keepFnArgs --outFile index.min.js