1.0.0 • Published 6 years ago
babel-plugin-variable-replace v1.0.0
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;
1.0.0
6 years ago