Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/oliviertassinari/babel-plugin-transform-dev-warning

Remove development warning from production code
https://github.com/oliviertassinari/babel-plugin-transform-dev-warning

babel babel-plugin dev warning

Last synced: 2 months ago
JSON representation

Remove development warning from production code

Awesome Lists containing this project

README

        

# Babel Plugin for removing warning call

[![Build Status](https://travis-ci.org/oliviertassinari/babel-plugin-transform-dev-warning.svg?branch=master)](https://travis-ci.org/oliviertassinari/babel-plugin-transform-dev-warning)
[![npm version](https://img.shields.io/npm/v/babel-plugin-transform-dev-warning.svg?style=flat-square)](https://www.npmjs.com/package/babel-plugin-transform-dev-warning)
[![npm downloads](https://img.shields.io/npm/dm/babel-plugin-transform-dev-warning.svg?style=flat-square)](https://www.npmjs.com/package/babel-plugin-transform-dev-warning)

This plugin removes development warning from production code.
It's recommended to be used with https://github.com/BerkeleyTrue/warning.

## Example

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

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

## Installation

```sh
$ npm install --save-dev babel-plugin-transform-dev-warning
```

## Usage

#### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
"env": {
"production": {
"plugins": ["transform-dev-warning"]
}
}
}
```

#### Via CLI

```sh
$ babel --plugins transform-dev-warning script.js
```

#### Via Node API

```js
require("babel-core").transform("code", {
plugins: ["transform-dev-warning"]
});
```

## License

MIT