babel-plugin-transform-babel-env-inline
v0.0.1
Published
Inline the `BABEL_ENV` environment variable and evaluate it if possible
Readme
Adapted from https://github.com/babel/babili/tree/master/packages/babel-plugin-transform-node-env-inline
babel-plugin-transform-babel-env-inline
Inline the BABEL_ENV environment variable and if it's a part of a binary expression
(eg. process.env.BABEL_ENV === "react") then statically evaluate and replace it.
Example
In
process.env.BABEL_ENV === "react";
process.env.BABEL_ENV === "inferno";Out
BABEL_ENV=react babel in.js --plugins transform-babel-env-inlinetrue;
false;Installation
npm install babel-plugin-transform-babel-env-inlineUsage
Via .babelrc (Recommended)
.babelrc
{
"plugins": ["transform-babel-env-inline"]
}Via CLI
babel --plugins transform-babel-env-inline script.jsVia Node API
require("babel-core").transform("code", {
plugins: ["transform-babel-env-inline"]
});