babel-plugin-variable-replace
v1.0.0
Published
This plugin, like Webpack's DefinePlugin , allows you to create a global variable and configure it in advance.
Downloads
3
Readme
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;