-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (36 loc) · 1.21 KB
/
index.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
const { resolve } = require;
const ENV = (process.env.BABEL_ENV || process.env.NODE_ENV);
const isProd = ENV === 'production';
// default supported browser.
const defaultBrowserList = ['> 0.25%', 'IE >= 9'];
module.exports = function () {
return {
presets: [
resolve('@babel/preset-typescript'),
[
resolve('@babel/preset-env'),
{
loose: true,
targets: {
browsers: defaultBrowserList,
},
exclude: ['transform-regenerator', 'transform-async-to-generator'],
},
],
resolve('@babel/preset-react')
],
plugins: [
resolve('@babel/plugin-syntax-dynamic-import'),
resolve('@babel/plugin-proposal-export-default-from'),
resolve('@babel/plugin-transform-object-assign'),
[resolve('@babel/plugin-proposal-decorators'), { legacy: true }],
[resolve('@babel/plugin-proposal-class-properties'), { loose: true }],
resolve('@babel/plugin-proposal-object-rest-spread'),
isProd &&
resolve('babel-plugin-transform-react-remove-prop-types'),
[resolve('fast-async'), { spec: true }],
resolve('babel-plugin-macros'),
resolve('react-hot-loader/babel'),
].filter(Boolean),
};
}