🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

babel-plugin-dev-debug

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-dev-debug

an babel plugin that for dev debug

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

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

Usage

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

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

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

debug

FAQs

Package last updated on 12 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts