-
Notifications
You must be signed in to change notification settings - Fork 45
/
babel.config.js
42 lines (39 loc) · 1.18 KB
/
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
35
36
37
38
39
40
41
42
module.exports = (api) => {
api.cache(true);
const envPreset = [
'@babel/env',
{
modules: false,
bugfixes: true,
useBuiltIns: 'usage',
corejs: { version: require('./package.json').devDependencies['core-js'] },
},
];
const importPlugin = [
'import',
{
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
},
];
return {
presets: ['@babel/preset-typescript', envPreset],
plugins: [
'@babel/plugin-transform-runtime',
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }],
'lodash',
importPlugin,
],
env: {
development: {
presets: [['@babel/preset-react', { runtime: 'automatic', development: true }]],
plugins: [require.resolve('react-refresh/babel')],
},
production: {
presets: [['@babel/preset-react', { runtime: 'automatic', development: false }]],
plugins: ['@babel/plugin-transform-react-constant-elements'],
},
},
};
};