babel-preset-babili

Babel preset for all minify plugins.

babili has been renamed to babel-minify. Please update to babel-preset-minify
Last updated 7 years ago by vignesh.shanmugam .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install babel-preset-babili 
SYNC missed versions from official npm registry.

babel-preset-babili

Babel preset for all minify plugins.

Install

npm install --save-dev babel-preset-babili

Usage

Via .babelrc (Recommended)

.babelrc

{
  "presets": ["babili"]
}

or pass in options -

{
  "presets": [["babili", {
    "mangle": {
      "blacklist": ["MyCustomError"]
    },
    "unsafe": {
      "typeConstructors": false
    },
    "keepFnName": true
  }]]
}

Via CLI

babel script.js --presets babili

Via Node API

require("babel-core").transform("code", {
  presets: ["babili"]
});

Options

Two types of options:

  1. 1-1 mapping with plugin
  2. The same option passed to multiple plugins

1-1 mapping with plugin

  • false - disable plugin
  • true - enable plugin
  • { ...pluginOpts } - enable plugin and pass pluginOpts to plugin
OptionName Plugin DefaultValue
booleans transform-minify-booleans true
builtIns minify-builtins true
consecutiveAdds transform-inline-consecutive-adds true
deadcode minify-dead-code-elimination true
evaluate minify-constant-folding true
flipComparisons minify-flip-comparisons true
guards minify-guarded-expressions true
infinity minify-infinity true
mangle minify-mangle-names true
memberExpressions transform-member-expression-literals true
mergeVars transform-merge-sibling-variables true
numericLiterals minify-numeric-literals true
propertyLiterals transform-property-literals true
regexpConstructors transform-regexp-constructors true
removeConsole transform-remove-console false
removeDebugger transform-remove-debugger false
removeUndefined transform-remove-undefined true
replace minify-replace true
simplify minify-simplify true
simplifyComparisons transform-simplify-comparison-operators true
typeConstructors minify-type-constructors true
undefinedToVoid transform-undefined-to-void true

The same option passed to multiple plugins

  • When multiple plugins require the same option, it's easier to declare it in one place. These options are passed on to two or more plugins.
OptionName Plugins
keepFnName Passed to mangle & deadcode
keepClassName Passed to mangle & deadcode

Examples

{
  "presets": [["babili", {
    "evaluate": false,
    "mangle": true
  }]]
}
{
  "presets": [["babili", {
    "mangle": {
      "blacklist": ["ParserError", "NetworkError"]
    }
  }]]
}
{
  "presets": [["babili", {
    "keepFnName": true
  }]]
}
// is the same as
{
  "presets": [["babili", {
    "mangle": {
      "keepFnName": true
    },
    "deadcode": {
      "keepFnName": true
    }
  }]]
}

Current Tags

  • 0.1.4                                ...           latest (7 years ago)

16 Versions

  • 0.1.4 [deprecated]           ...           7 years ago
  • 0.1.3 [deprecated]           ...           7 years ago
  • 0.1.2 [deprecated]           ...           7 years ago
  • 0.1.1 [deprecated]           ...           7 years ago
  • 0.1.0 [deprecated]           ...           7 years ago
  • 0.0.12 [deprecated]           ...           8 years ago
  • 0.0.11 [deprecated]           ...           8 years ago
  • 0.0.10 [deprecated]           ...           8 years ago
  • 0.0.9 [deprecated]           ...           8 years ago
  • 0.0.8 [deprecated]           ...           8 years ago
  • 0.0.5 [deprecated]           ...           8 years ago
  • 0.0.4 [deprecated]           ...           8 years ago
  • 0.0.3 [deprecated]           ...           8 years ago
  • 0.0.2 [deprecated]           ...           8 years ago
  • 0.0.1 [deprecated]           ...           8 years ago
  • 1.0.0 [deprecated]           ...           8 years ago

© 2010 - cnpmjs.org x YWFE | Home | YWFE