babel-plugin-env-debug

1.0.4 • Public • Published

babel-plugin-env-debug

介绍

根据自己配置的环境来判断代码是否会被执行

安装教程

npm i babel-plugin-env-debug

使用说明

babel.config.js文件中

  module.exports = {
    plugins:[["env-debug",{
      env: 'production'
    }]]
  };

在你的代码中

  if (DEBUG) {
    const a = 10;
    const b = 10;
    console.log(a + b);
  }

如何使用了eslint 在.eslintrc中

  module.exports = {
    globals: {
      DEBUG: true
    }
  }

Readme

Keywords

Package Sidebar

Install

npm i babel-plugin-env-debug

Weekly Downloads

1

Version

1.0.4

License

ISC

Unpacked Size

3.17 kB

Total Files

4

Last publish

Collaborators

  • barcodeing