https://github.com/mastilver/babel-preset-when
https://github.com/mastilver/babel-preset-when
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mastilver/babel-preset-when
- Owner: mastilver
- License: mit
- Created: 2016-12-12T12:44:29.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-25T11:38:05.000Z (over 9 years ago)
- Last Synced: 2025-08-15T20:17:04.347Z (11 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# babel-preset-when [](https://travis-ci.org/mastilver/babel-preset-when)
> Conditional babel preset
## Install
```
$ npm install --save babel-preset-when
```
## Usage
### Via .babelrc (Recommended)
.babelrc
```js
{
"presets": [
"when": {
"IS_SERVER": {
"true": {
"presets": ["es2015-node"]
},
"false": {
"presets": ["es2015"]
}
},
"NODE_ENV=development": {
"development": {
plugins: ["rewire"]
}
}
}
]
}
```
Running: `IS_SERVER=true babel src`
will use `es-2015-node` rather than `es2015` and `rewire` as the default
## License
MIT © [Thomas Sileghem](http://mastilver.com)