forked from atropos-tech/material-multi-picker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
babel.config.js
34 lines (29 loc) · 915 Bytes
/
babel.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* eslint-env node */
/* eslint-disable import/no-commonjs */
const DEVELOP_CONFIG = {
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": ["react-hot-loader/babel"]
};
// exclude the react-hot-loader when transpiling for publish
const PRODUCTION_CONFIG = {
"presets": ["@babel/preset-env", "@babel/preset-react"]
};
// we need a seperate config for test because Jest no longer packages
// the regenerator runtime, so support for async functions has to be
// grabbed from NodeJS, which requires extra configuration that won't
// work for browsers!
const TEST_CONFIG = {
"presets": [
["@babel/preset-env", { targets: { node: "current" } }],
"@babel/preset-react"
]
};
module.exports = api => {
if (api.env("test")) {
return TEST_CONFIG;
}
if ( api.env("production")) {
return PRODUCTION_CONFIG;
}
return DEVELOP_CONFIG;
};