Babel Plugin Dev Expression screenshot

Babel Plugin Dev Expression

Author Avatar Theme by 4catalyzer
Updated: 22 Oct 2021
188 Stars

A mirror of Facebook's dev-expression Babel plugin

Overview

The babel-plugin-dev-expression npm version is a mirror of Facebook’s dev-expression Babel plugin, designed to reduce or eliminate development checks in production code. It replaces __DEV__ with certain expressions to streamline the codebase.

Features

  • Replaces __DEV__ with expressions
  • Transforms invariant to global constant
  • Recommended for use with invariant or tiny-invariant
  • Transforms warning to global constant
  • Recommended for use with warning or tiny-warning

Installation

To install the babel-plugin-dev-expression npm version, follow these steps:

  1. Run the following command in your project directory:
    npm install babel-plugin-dev-expression --save-dev
    
  2. Update your Babel configuration file (e.g., .babelrc) to include:
    {
      "plugins": ["dev-expression"]
    }
    

Summary

The babel-plugin-dev-expression npm version is a useful tool for streamlining production code by replacing development-specific expressions with global constants. It simplifies the codebase and is recommended for use with popular libraries like invariant and warning or their smaller alternatives.