# babel-plugin-dev-expression

> A mirror of Facebook's dev-expression Babel plugin

Latest version **0.2.3** (published 2021-10-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-dev-expression
pnpm add babel-plugin-dev-expression
yarn add babel-plugin-dev-expression
bun add babel-plugin-dev-expression
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2021-10-25 |
| First published | 2015-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 187 |
| Author | Jimmy Jia |
| Maintainers | monastic.panic, taion |
| Keywords | facebook, react, babel, dev-expression |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-dev-expression
- Repository: https://github.com/4Catalyzer/babel-plugin-dev-expression
- Homepage: https://github.com/4Catalyzer/babel-plugin-dev-expression#readme
- Issues: https://github.com/4Catalyzer/babel-plugin-dev-expression/issues
- npm.io page: https://npm.io/package/babel-plugin-dev-expression

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.2.3 (latest) — 2021-10-25
- 0.2.2 — 2019-07-07
- 0.2.1 — 2016-03-09
- 0.2.0 — 2016-03-09
- 0.1.0 — 2015-11-02

## README

# babel-plugin-dev-expression [![npm version](https://badge.fury.io/js/babel-plugin-dev-expression.svg)](https://badge.fury.io/js/babel-plugin-dev-expression)

A mirror of Facebook's dev-expression Babel plugin.

This plugin reduces or eliminates development checks from production code.

## `__DEV__`

Replaces

```js
__DEV__
```

with

```js
process.env.NODE_ENV !== 'production'
```

**Note:** The `dev-expression` transform does not run when `NODE_ENV` is `test`. As such, if you use `__DEV__`, you will need to define it as a global constant in your test environment.

## `invariant`

Replaces

```js
invariant(condition, argument, argument);
```

with

```js
if (!condition) {
  if ("production" !== process.env.NODE_ENV) {
    invariant(false, argument, argument);
  } else {
    invariant(false);
  }
}
```

Recommended for use with https://github.com/zertosh/invariant or smaller https://github.com/alexreardon/tiny-invariant.

## `warning`

Replaces

```js
warning(condition, argument, argument);
```

with

```js
if ("production" !== process.env.NODE_ENV) {
  warning(condition, argument, argument);
}
```

Recommended for use with https://github.com/r3dm/warning or smaller https://github.com/alexreardon/tiny-warning.

---
_Source: https://npm.io/package/babel-plugin-dev-expression · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
