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
- Yarn
- pnpm
npm install babel-plugin-minify-builtins --save-dev
yarn add babel-plugin-minify-builtins --dev
pnpm add babel-plugin-minify-builtins --save-dev
Usage
With a configuration file (Recommended)
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