babel-plugin-minify-dead-code-elimination
Inlines bindings when possible. Tries to evaluate expressions and prunes unreachable as a result.
Last updated 8 months ago by hzoo .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install babel-plugin-minify-dead-code-elimination 
SYNC missed versions from official npm registry.

babel-plugin-minify-dead-code-elimination

Inlines bindings when possible. Tries to evaluate expressions and prunes unreachable as a result.

Example

In

function foo() {var x = 1;}
function bar() { var x = f(); }
function baz() {
  var x = 1;
  console.log(x);
  function unused() {
    return 5;
  }
}

Out

function foo() {}
function bar() { f(); }
function baz() {
  console.log(1);
}

Installation

npm install babel-plugin-minify-dead-code-elimination --save-dev

Usage

Via .babelrc (Recommended)

.babelrc

// without options
{
  "plugins": ["minify-dead-code-elimination"]
}

// with options
{
  "plugins": ["minify-dead-code-elimination", { "optimizeRawSize": true }]
}

Via CLI

babel --plugins minify-dead-code-elimination script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["minify-dead-code-elimination"]
});

Options

  • keepFnName - prevent plugin from removing function name. Useful for code depending on fn.name
  • keepFnArgs - prevent plugin from removing function args. Useful for code depending on fn.length
  • keepClassName - prevent plugin from removing class name. Useful for code depending on cls.name
  • tdz - Account for TDZ (Temporal Dead Zone)

Current Tags

  • 0.6.0-alpha.5                                ...           canary (a year ago)
  • 0.5.1                                ...           latest (8 months ago)

90 Versions

  • 0.5.1                                ...           8 months ago
  • 0.6.0-alpha.5                                ...           a year ago
  • 0.6.0-alpha.4                                ...           a year ago
  • 0.5.0                                ...           2 years ago
  • 0.5.0-alpha.9                                ...           2 years ago
  • 0.5.0-alpha.3cc09dcf                                ...           2 years ago
  • 0.5.0-alpha.beb87b9a                                ...           2 years ago
  • 0.5.0-alpha.5a128fd5                                ...           2 years ago
  • 0.5.0-alpha.2ed85317                                ...           2 years ago
  • 0.5.0-alpha.a24dd066                                ...           2 years ago
  • 0.5.0-alpha.2e0de171                                ...           2 years ago
  • 0.5.0-alpha.89fc69da                                ...           2 years ago
  • 0.5.0-alpha.a28b6b00                                ...           2 years ago
  • 0.5.0-alpha.2ec8ff72                                ...           2 years ago
  • 0.5.0-alpha.01eac1c3                                ...           2 years ago
  • 0.5.0-alpha.5dbc73f7                                ...           2 years ago
  • 0.5.0-alpha.830ce3f1                                ...           2 years ago
  • 0.5.0-alpha.9e447f6d                                ...           2 years ago
  • 0.5.0-alpha.3b1a8f05                                ...           2 years ago
  • 0.5.0-alpha.367cc048                                ...           2 years ago
  • 0.5.0-alpha.36b27d42                                ...           2 years ago
  • 0.5.0-alpha.7ba5821f                                ...           2 years ago
  • 0.5.0-alpha.7195fa98                                ...           2 years ago
  • 0.5.0-alpha.1cb46b73                                ...           2 years ago
  • 0.5.0-alpha.85c9b6d8                                ...           2 years ago
  • 0.5.0-alpha.6889f45d                                ...           2 years ago
  • 0.5.0-alpha.91ed3622                                ...           2 years ago
  • 0.4.3                                ...           2 years ago
  • 0.5.0-alpha.b5637c57                                ...           2 years ago
  • 0.4.2                                ...           2 years ago
  • 0.5.0-alpha.540d75e7                                ...           2 years ago
  • 0.5.0-alpha.bce578e2                                ...           2 years ago
  • 0.5.0-alpha.18dcfe13                                ...           2 years ago
  • 0.5.0-alpha.9939bca9                                ...           2 years ago
  • 0.5.0-alpha.5f601890                                ...           2 years ago
  • 0.5.0-alpha.34c3efe9                                ...           2 years ago
  • 0.5.0-alpha.9e986477                                ...           2 years ago
  • 0.5.0-alpha.e86a44f1                                ...           2 years ago
  • 0.4.1                                ...           2 years ago
  • 0.5.0-alpha.e9f96ffe                                ...           2 years ago
  • 0.5.0-alpha.8b905991                                ...           2 years ago
  • 0.5.0-alpha.b4285271                                ...           2 years ago
  • 0.5.0-alpha.7b176463                                ...           2 years ago
  • 0.5.0-alpha.55276695                                ...           2 years ago
  • 0.5.0-alpha.b5bafaeb                                ...           2 years ago
  • 0.5.0-alpha.72092d20                                ...           2 years ago
  • 0.4.0                                ...           2 years ago
  • 0.4.0-alpha.caaefb4c                                ...           2 years ago
  • 0.4.0-alpha.f95869d4                                ...           2 years ago
  • 0.4.0-alpha.12994a48                                ...           2 years ago
  • 0.4.0-alpha.4b14df35                                ...           2 years ago
  • 0.4.0-alpha.6546ad11                                ...           2 years ago
  • 0.4.0-alpha.15ca1f11                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.3.0-alpha.4143a25b                                ...           2 years ago
  • 0.3.0-alpha.71b0b884                                ...           2 years ago
  • 0.3.0-alpha.6ceffb8d                                ...           2 years ago
  • 0.3.0-alpha.636ae276                                ...           2 years ago
  • 0.3.0-alpha.ab81368f                                ...           2 years ago
  • 0.3.0-alpha.ac576234                                ...           2 years ago
  • 0.3.0-alpha.879f25ec                                ...           2 years ago
  • 0.3.0-alpha.5ee3078e                                ...           2 years ago
  • 0.3.0-alpha.8857f145                                ...           2 years ago
  • 0.3.0-alpha.169f8743                                ...           2 years ago
  • 0.3.0-alpha.6ae655c0                                ...           2 years ago
  • 0.3.0-alpha.d9c99d3f                                ...           2 years ago
  • 0.3.0-alpha.a351eeed                                ...           2 years ago
  • 0.3.0-alpha.cf9a0da2                                ...           2 years ago
  • 0.3.0-alpha.e6a189cd                                ...           2 years ago
  • 0.3.0-alpha.670b24ec                                ...           2 years ago
  • 0.3.0-alpha.7f4dc3d4                                ...           2 years ago
  • 0.3.0-alpha.033d9ab6                                ...           2 years ago
  • 0.3.0-alpha.37064b40                                ...           2 years ago
  • 0.3.0-alpha.9a74dfd1                                ...           2 years ago
  • 0.3.0-alpha.a7421897                                ...           2 years ago
  • 0.3.0-alpha.da60c6b8                                ...           2 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.7                                ...           3 years ago
  • 0.1.6                                ...           3 years ago
  • 0.1.5                                ...           3 years ago
  • 0.1.4                                ...           3 years ago
  • 0.1.3                                ...           3 years ago
  • 0.1.2                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.0.5                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.4                                ...           4 years ago
  • 0.0.3                                ...           4 years ago
  • 0.0.2                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Downloads
Today 851
This Week 1,319
This Month 4,703
Last Day 468
Last Week 5,213
Last Month 23,051
Dev Dependencies (0)
None
Dependents (128)

Copyright 2014 - 2016 © taobao.org |