bpe

babel-plugin-envify

babel plugin envify to remove useless code according to environment variables

Showing:

Popularity

Downloads/wk

58

Maintenance

No Maintenance Data Available

Package

Dependencies

3

Size (min+gzip)

0.6KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

babel-plugin-envify

remove useless process.env judgment according to environment variables for babel

Install

npm i -D babel-plugin-envify

Usage

add file .babelrc to your project root directory, and add plugin:

{
  "plugins": [
    [
      "envify",
      {
        "omit": ["SOME_NAME"]
      }
    ]
  ]
}

then run babel in command line.

  • The omit option specified fields will not be handled.

Function

If a if statement's test is one binary expression, and left node or right node is member expression as process.env.{ENV_NAME}, and the another node is string literal.

Will be remove or replace by consequent or alternate according to current environment variable's value.

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100