babel-plugin-variable-replace

1.0.0 • Public • Published

babel-plugin-variable-replace"

This plugin, like Webpack's DefinePlugin , allows you to create a global variable and configure it in advance. ## Usage

### install

npm i babel-plugin-variable-replace --save-dev

### .babelrc

{
  "plugins": [
    ["variable-replace", {
      "___TITLE___": "title",
      "___ENV___":"production"
    }]
  ]
}

## in

const title = ___TITLE___;
const env = ___ENV___;
const isProduction = ___ENV___==="production";

out

const title = title;
const env = production;
const isProduction = true;

Readme

Keywords

Package Sidebar

Install

npm i babel-plugin-variable-replace

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

12.5 kB

Total Files

4

Last publish

Collaborators

  • xzc