babel-plugin-minify-replace
Configurable "search and replace" plugin. Replaces matching nodes in the tree with a given replacement node. For example you can replace process.NODE_ENV
with "production"
.
Example
Options
identifierName: "__DEV__" replacement: type: "numericLiteral" value: 0
In
if !__DEV__ ;if a__DEV__ ;
Out
if !0 ;if a__DEV__ ;
Installation
npm install babel-plugin-minify-replace --save-dev
Usage
.babelrc
(Recommended)
Via .babelrc
// without options
// with options
Via CLI
babel --plugins minify-replace script.js
Via Node API
;