babel-plugin-transform-dev-warning
Version:
Remove development warning from production code
63 lines (45 loc) • 1.33 kB
Markdown
# Babel Plugin for removing warning call
[](https://travis-ci.org/oliviertassinari/babel-plugin-transform-dev-warning)
[](https://www.npmjs.com/package/babel-plugin-transform-dev-warning)
[](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/r3dm/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