-
Notifications
You must be signed in to change notification settings - Fork 0
/
.babelrc.js
55 lines (50 loc) · 1.21 KB
/
.babelrc.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const { NODE_ENV } = process.env;
const modules = NODE_ENV === 'test' ? 'commonjs' : false;
const loose = true;
const envPlugins = {
development: ['react-hot-loader/babel'],
production: [
[
'@babel/plugin-transform-runtime',
{
corejs: false,
helpers: true,
regenerator: true,
useESModules: true
}
],
'transform-react-remove-prop-types'
],
test: []
};
module.exports = {
presets: [
[
'@babel/preset-env',
{
modules,
loose,
targets: {
browsers: ['last 2 Chrome versions']
}
}
],
'@babel/preset-react'
],
plugins: [
['@babel/plugin-proposal-class-properties', { loose }],
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-syntax-dynamic-import',
'babel-plugin-styled-components',
...envPlugins[NODE_ENV],
'@babel/plugin-proposal-optional-chaining'
].filter(Boolean)
// "plugins": [
// "@babel/transform-react-constant-elements",
// "@babel/transform-react-inline-elements",
// "transform-react-pure-class-to-function",
// "@babel/transform-runtime",
// ["babel-plugin-root-import", {
// "rootPathSuffix": "."
// }]
};