babel-plugin-transform-babel-env-inline

0.0.1 • Public • Published

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-inline
true;
false;

Installation

npm install babel-plugin-transform-babel-env-inline

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["transform-babel-env-inline"]
}

Via CLI

babel --plugins transform-babel-env-inline script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-babel-env-inline"]
});

Readme

Keywords

Package Sidebar

Install

npm i babel-plugin-transform-babel-env-inline

Weekly Downloads

2

Version

0.0.1

License

MIT

Last publish

Collaborators

  • mariusandra