跳到主要内容

babel-plugin-minify-builtins

Example

In

JavaScript
Math.floor(a) + Math.floor(b)

Out

JavaScript
var _Mathfloor = Math.floor;

_Mathfloor(a) + _Mathfloor(b);

Installation

npm install babel-plugin-minify-builtins --save-dev

Usage

babel.config.json
{
"plugins": ["minify-builtins"]
}

Via CLI

Shell
babel --plugins minify-builtins script.js

Via Node API

JavaScript
require("@babel/core").transformSync("code", {
plugins: ["minify-builtins"]
});

Options

  • tdz - Account for TDZ (Temporal Dead Zone)
提示

You can read more about configuring plugin options here