1.0.0 • Published 2 years ago

babel-plugin-dev-debug-mooyn v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

babel-plugin-dev-debug

an babel plugin that for dev debug

why

Sometimes we need to write some logic in the development environment for debugging and development purposes

However, we don't want the debug code to be released to the production environment

This plugin is designed to solve this problem

Install

npm i babel-plugin-dev-debug-mooyn

Usage

add babel-plugin-dev-debug-mooyn plugin to babel.config.js

// babel.config.js
module.exports = {
  plugins: ["dev-debug-mooyn"],
};

in you code

if (DEBUG) {
  // do something for debug
  // removed in production env
  const a = 10;
  const b = 20;
  console.log(a + b);
}

if you use eslint you must be add DEBUG to globals to eslint.config.js

// .eslintrc.js
module.exports = {
  globals: {
    DEBUG: true,
  },
};

Keywords