-
Notifications
You must be signed in to change notification settings - Fork 6
/
babel.config.js
52 lines (52 loc) · 1.28 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
43
44
45
46
47
48
49
50
51
52
module.exports = {
presets: [
[
'@babel/preset-env',
{
// corejs: 3,
// debug: true,
// useBuiltIns: 'usage', // 开启浏览器兼容 polyfills,会根据browserslist配置,引入需要的库,需要安装对应版本的 core-js@3
},
],
[
'@babel/preset-react',
{
runtime: 'automatic',
},
],
'@babel/preset-typescript',
],
plugins: [
'lodash',
'@babel/plugin-transform-runtime',
// 'babel-plugin-styled-components',
// '@babel/plugin-transform-react-inline-elements',
// '@babel/plugin-transform-react-constant-elements',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-syntax-dynamic-import',
// 'react-hot-loader/babel',
[
'import',
{
libraryName: 'antd',
libraryDirectory: 'es',
style: true, // or 'css'
},
'antd',
],
].filter(Boolean),
env: {
production: {
// only: ['app'],
plugins: [
'lodash',
'transform-react-remove-prop-types',
'@babel/plugin-transform-react-inline-elements',
'@babel/plugin-transform-react-constant-elements',
],
},
test: {
plugins: ['@babel/plugin-transform-modules-commonjs', 'dynamic-import-node'],
},
},
};