babel-plugin-minify-builtins

Example

In

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

Out

  1. var _Mathfloor = Math.floor;
  2. _Mathfloor(a) + _Mathfloor(b);

Installation

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

Usage

.babelrc

  1. {
  2. "plugins": ["minify-builtins"]
  3. }

Via CLI

  1. babel --plugins minify-builtins script.js

Via Node API

  1. require("@babel/core").transform("code", {
  2. plugins: ["minify-builtins"]
  3. });

Options

  • tdz - Account for TDZ (Temporal Dead Zone)

You can read more about configuring plugin options here