-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathbabel.config.js
30 lines (28 loc) · 971 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
const devEnvs = ['development', 'test'];
const devPlugins = [require('react-hot-loader/babel')];
const prodPlugins = [
require('@babel/plugin-transform-react-constant-elements'),
require('@babel/plugin-transform-react-inline-elements'),
require('babel-plugin-transform-react-remove-prop-types')
];
module.exports = api => {
const development = api.env(devEnvs);
return {
presets: [
[require('@babel/preset-env'), {
targets: {
electron: 'v8.2.0'
}
}],
require('@babel/preset-typescript'),
[require('@babel/preset-react'), {development, throwIfNamespace: false}]
],
plugins: [
[require('@babel/plugin-proposal-optional-chaining'), {loose: false}],
[require('@babel/plugin-proposal-decorators'), {legacy: true}],
require('@babel/plugin-syntax-dynamic-import'),
require('@babel/plugin-proposal-class-properties'),
...(development ? devPlugins : prodPlugins)
]
};
};