✂️ An ES6+ aware minifier based on the Babel toolchain (beta)
JavaScript Python Shell
Switch branches/tags
v0.0.1 gulp-babili@0.1.4 gulp-babili@0.1.3 gulp-babili@0.1.2 gulp-babili@0.1.1 gulp-babili@0.1.0 gulp-babili@0.0.2 gulp-babel-minify@0.4.3 gulp-babel-minify@0.4.2 gulp-babel-minify@0.4.1 gulp-babel-minify@0.4.0 gulp-babel-minify@0.3.0 gulp-babel-minify@0.2.0 babili@0.1.4 babili@0.1.3 babili@0.1.2 babili@0.1.1 babili@0.1.0 babili@0.0.12 babili@0.0.11 babili@0.0.10 babili@0.0.9 babili@0.0.8 babili@0.0.7 babili@0.0.6 babili@0.0.5 babili@0.0.4 babili@v0.0.3 babili@v0.0.2 babel-preset-minify@0.4.3 babel-preset-minify@0.4.2 babel-preset-minify@0.4.1 babel-preset-minify@0.4.0 babel-preset-minify@0.3.0 babel-preset-minify@0.2.0 babel-preset-babili@0.1.4 babel-preset-babili@0.1.3 babel-preset-babili@0.1.2 babel-preset-babili@0.1.1 babel-preset-babili@0.1.0 babel-preset-babili@0.0.12 babel-preset-babili@0.0.11 babel-preset-babili@0.0.10 babel-preset-babili@0.0.8 babel-preset-babili@0.0.5 babel-preset-babili@0.0.4 babel-preset-babili@0.0.3 babel-preset-babili@0.0.2 babel-plugin-transform-undefined-to-void@6.9.4 babel-plugin-transform-undefined-to-void@6.9.3 babel-plugin-transform-undefined-to-void@6.9.2 babel-plugin-transform-undefined-to-void@6.9.1 babel-plugin-transform-undefined-to-void@6.9.0 babel-plugin-transform-undefined-to-void@6.8.3 babel-plugin-transform-undefined-to-void@6.8.2 babel-plugin-transform-undefined-to-void@6.8.1 babel-plugin-transform-simplify-comparison-operators@6.9.4 babel-plugin-transform-simplify-comparison-operators@6.9.3 babel-plugin-transform-simplify-comparison-operators@6.9.2 babel-plugin-transform-simplify-comparison-operators@6.9.1 babel-plugin-transform-simplify-comparison-operators@6.9.0 babel-plugin-transform-simplify-comparison-operators@6.8.5 babel-plugin-transform-simplify-comparison-operators@6.8.4 babel-plugin-transform-simplify-comparison-operators@6.8.3 babel-plugin-transform-simplify-comparison-operators@6.8.2 babel-plugin-transform-simplify-comparison-operators@6.8.1 babel-plugin-transform-remove-undefined@0.4.3 babel-plugin-transform-remove-undefined@0.4.2 babel-plugin-transform-remove-undefined@0.4.1 babel-plugin-transform-remove-undefined@0.4.0 babel-plugin-transform-remove-undefined@0.3.0 babel-plugin-transform-remove-undefined@0.2.0 babel-plugin-transform-remove-undefined@0.1.2 babel-plugin-transform-remove-undefined@0.1.1 babel-plugin-transform-remove-undefined@0.1.0 babel-plugin-transform-remove-undefined@0.0.5 babel-plugin-transform-remove-undefined@0.0.4 babel-plugin-transform-remove-debugger@6.9.4 babel-plugin-transform-remove-debugger@6.9.3 babel-plugin-transform-remove-debugger@6.9.2 babel-plugin-transform-remove-debugger@6.9.1 babel-plugin-transform-remove-debugger@6.9.0 babel-plugin-transform-remove-debugger@6.8.5 babel-plugin-transform-remove-debugger@6.8.4 babel-plugin-transform-remove-debugger@6.8.3 babel-plugin-transform-remove-debugger@6.8.2 babel-plugin-transform-remove-debugger@6.8.1 babel-plugin-transform-remove-console@6.9.4 babel-plugin-transform-remove-console@6.9.3 babel-plugin-transform-remove-console@6.9.2 babel-plugin-transform-remove-console@6.9.1 babel-plugin-transform-remove-console@6.9.0 babel-plugin-transform-remove-console@6.8.5 babel-plugin-transform-remove-console@6.8.4 babel-plugin-transform-remove-console@6.8.3 babel-plugin-transform-remove-console@6.8.2 babel-plugin-transform-remove-console@6.8.1 babel-plugin-transform-regexp-constructors@0.4.3 babel-plugin-transform-regexp-constructors@0.4.2 babel-plugin-transform-regexp-constructors@0.4.1
Nothing to show
Clone or download
Failed to load latest commit information.
.github chore: Update babel to 7.0.0-beta.49 (#872) Jun 11, 2018
docs add lint-staged - lint and test Jan 20, 2018
packages chore: update to babel 7.0.0-beta.54 (#887) Jul 27, 2018
scripts feat(bench): add terser. remove butternut (#883) Jul 17, 2018
smoke chore: upgrade dependencies; add node 10; remove node 9 (#827) May 1, 2018
utils Publish May 3, 2018
.editorconfig Add editorconfig (#63) Jul 30, 2016
.eslintignore Fix lint issues Nov 8, 2017
.eslintrc.js chore(eslint): mark as root config Feb 26, 2018
.gitattributes Specify *.jar as binary in gitattributes (#714) Nov 7, 2017
.gitignore ignore tmp files (*~$) Nov 9, 2017
.gitmodules Remove draft-js from smoktests dir (#648) Aug 8, 2017
.prettierignore feat(bench): add terser. remove butternut (#883) Jul 17, 2018
.travis.yml chore: travis- remove submodule, appveyor- upgrade yarn Jun 1, 2018
.yarnrc Add yarnrc for Travis yarn@0.27.5 Sep 18, 2017
CHANGELOG.md chore: add changelog babel-minify@0.4.3 [skip ci] May 14, 2018
CODE_OF_CONDUCT.md Update CodeOfConduct to Contributor Covenant 1.4 [skip ci] (#737) Dec 11, 2017
CONTRIBUTING.md add friendly introduction to contributing.md from https://github.com/… May 14, 2018
LICENSE Add license (#98) Aug 26, 2016
NPM_OWNERS npm owners scripts Oct 24, 2016
README.md Update link to babili blog post (#888) Jul 26, 2018
appveyor.yml chore: travis- remove submodule, appveyor- upgrade yarn Jun 1, 2018
babel.config.js chore: upgrade dependencies; add node 10; remove node 9 (#827) May 1, 2018
circle.yml Update CI yml files (#716) Nov 7, 2017
codecov.yml revert ci tweaks Jan 19, 2018
gulpfile.js feat: upgrade to babel-7 Feb 15, 2018
lerna.json internal: add Tag: Perf for labelling performance improvements May 16, 2018
package.json chore: update to babel 7.0.0-beta.54 (#887) Jul 27, 2018
yarn.lock chore: update to babel 7.0.0-beta.54 (#887) Jul 27, 2018



An ES6+ aware minifier based on the Babel toolchain.

NPM Version Travis Status CircleCI Status AppveyorCI Status Code Coverage Slack Status NPM Downloads


Babili has been now renamed to Babel-Minify :).

Table of Contents


  • node >= 4
  • babel >= 6.20.0


Current tools don't support targeting the latest version of ECMAScript. (yet)

  • BabelMinify can because it is just a set of Babel plugins, and Babel already understands new syntax with our parser Babylon.
  • When it's possible to only target browsers that support newer ES features, code sizes can be smaller because you don't have to transpile and then minify.

Check out our blog post for more info!

// Example ES2015 Code
class Mangler {
  constructor(program) {
    this.program = program;
new Mangler(); // without this it would just output nothing since Mangler isn't used


// ES2015+ code -> Babel -> BabelMinify/Uglify -> Minified ES5 Code
var a=function a(b){_classCallCheck(this,a),this.program=b};new a;


// ES2015+ code -> BabelMinify -> Minified ES2015+ Code
class a{constructor(b){this.program=b}}new a;


Package Version Dependencies
babel-minify npm Dependency Status


npm install babel-minify --save-dev


minify src -d lib

Babel preset

Package Version Dependencies
babel-preset-minify npm Dependency Status


npm install babel-preset-minify --save-dev


You'll most likely want to use it only in the production environment. Check out the env docs for more help.

Options specific to a certain environment are merged into and overwrite non-env specific options.


  "presets": ["es2015"],
  "env": {
    "production": {
      "presets": ["minify"]

Then you'll need to set the env variable which could be something like BABEL_ENV=production npm run build

Individual Plugins

The minify repo is comprised of many npm packages. It is a lerna monorepo similar to babel itself.

The npm package babel-preset-minify is at the path packages/babel-preset-minify

Package Version Dependencies
babel-plugin-minify-constant-folding npm Dependency Status
babel-plugin-minify-dead-code-elimination npm Dependency Status
babel-plugin-minify-flip-comparisons npm Dependency Status
babel-plugin-minify-guarded-expressions npm Dependency Status
babel-plugin-minify-infinity npm Dependency Status
babel-plugin-minify-mangle-names npm Dependency Status
babel-plugin-minify-replace npm Dependency Status
babel-plugin-minify-simplify npm Dependency Status
babel-plugin-minify-type-constructors npm Dependency Status
babel-plugin-transform-member-expression-literals npm Dependency Status
babel-plugin-transform-merge-sibling-variables npm Dependency Status
babel-plugin-transform-minify-booleans npm Dependency Status
babel-plugin-transform-property-literals npm Dependency Status
babel-plugin-transform-simplify-comparison-operators npm Dependency Status
babel-plugin-transform-undefined-to-void npm Dependency Status


Normally you wouldn't be consuming the plugins directly since the preset is available.

Add to your .babelrc's plugins array.

  "plugins": ["babel-plugin-transform-undefined-to-void"]


Package Version Dependencies
babel-plugin-transform-inline-environment-variables npm Dependency Status
babel-plugin-transform-node-env-inline npm Dependency Status
babel-plugin-transform-remove-console npm Dependency Status
babel-plugin-transform-remove-debugger npm Dependency Status


Bootstrap: npm run bootstrap

Build: npm run build

Running the benchmarks: ./scripts/benchmark.js [file...] - defaults to a few packages fetched from unpkg.com and is defined in benchmark.js.

Note: All Input sources are ES5.

Benchmark Results for react.js:

Input Size: 54.79KB

Input Size (gzip): 15.11KB

minifier output raw raw win gzip output gzip win parse time (ms) minify time (ms)
babel-minify 15.97KB 71% 6.08KB 60% 1.00 1039.06
terser 15.65KB 71% 5.98KB 60% 0.93 532.19
uglify 15.6KB 72% 6KB 60% 1.09 463.69
closure-compiler 15.74KB 71% 6.04KB 60% 1.22 2361.41
closure-compiler-js 18.21KB 67% 6.73KB 55% 1.08 3381.47

Benchmark Results for vue.js:

Input Size: 282.52KB

Input Size (gzip): 77.52KB

minifier output raw raw win gzip output gzip win parse time (ms) minify time (ms)
babel-minify 104.21KB 63% 38.71KB 50% 6.09 3538.30
terser 103.12KB 63% 37.92KB 51% 6.42 1680.85
uglify 102.71KB 64% 38.08KB 51% 6.59 1662.50
closure-compiler 101.93KB 64% 38.6KB 50% 10.41 4413.06
closure-compiler-js 105.18KB 63% 39.5KB 49% 6.79 12082.80

Benchmark Results for lodash.js:

Input Size: 527.18KB

Input Size (gzip): 94.04KB

minifier output raw raw win gzip output gzip win parse time (ms) minify time (ms)
babel-minify 69.59KB 87% 24.37KB 74% 5.38 2587.27
terser 68.66KB 87% 24.31KB 74% 6.41 1913.43
uglify 68.15KB 87% 24.05KB 74% 5.89 2075.71
closure-compiler 71.05KB 87% 24.19KB 74% 6.24 4119.43
closure-compiler-js 73.51KB 86% 24.94KB 73% 5.17 9650.59

Benchmark Results for three.js:

Input Size: 1.05MB

Input Size (gzip): 212.43KB

minifier output raw raw win gzip output gzip win parse time (ms) minify time (ms)
babel-minify 535.88KB 50% 134.66KB 37% 27.24 9988.57
terser 536.16KB 50% 132.78KB 37% 28.39 3919.34
uglify 533.42KB 50% 133.21KB 37% 26.15 4025.20
closure-compiler 532.44KB 51% 134.41KB 37% 29.96 9029.19
closure-compiler-js 543.08KB 50% 136.3KB 36% 24.36 95743.77

Browser support

Babel Minify is best at targeting latest browsers (with full ES6+ support) but can also be used with the usual Babel es2015 preset to transpile down the code first.


Amjad Masad Boopathi Rajaa Juriy Zaytsev Henry Zhu Vignesh Shanmugam
Amjad Masad Boopathi Rajaa Juriy Zaytsev Henry Zhu Vignesh Shanmugam
@amasad @boopathi @kangax @hzoo @vigneshshanmugam
@amasad @heisenbugger @kangax @left_pad @_vigneshh