/babel-plugin-transform-dev-prod-expression

A babel plugin to transform __DEV__ and __PROD__ expressions

Primary LanguageJavaScriptMIT LicenseMIT

babel-plugin-transform-dev-prod-expression

Build Status npm (scoped)

A babel plugin to transform __DEV__ and __PROD__ expressions.

Installation

yarn add @iaziz786/babel-plugin-transform-dev-prod-expression

What magic it does?

It can convert this:

if (__DEV__) {
  // some script to run in development mode
}

if (__PROD__) {
  // some script to run in production mode
}

Into this:

if (process.env.NODE_ENV === 'development') {
  // some script to run in development mode
}

if (process.env.NODE_ENV === 'production') {
  // some script to run in production mode
}