-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy path.babelrc.js
103 lines (103 loc) · 2.75 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* eslint-disable global-require */
module.exports = {
targets: ">1%, not ie 11",
presets: [
[
"@babel/preset-env",
{
// Allow importing core-js in entrypoint and use browserlist to select polyfills
useBuiltIns: "entry",
// Set the corejs version we are using to avoid warnings in console
corejs: 3,
// Exclude transforms that make all code slower
exclude: ["transform-typeof-symbol"],
},
],
[
"@babel/preset-react",
{
// "pragma": "dom", // default pragma is React.createElement (only in classic runtime)
// "pragmaFrag": "DomFrag", // default is React.Fragment (only in classic runtime)
runtime: "automatic",
development: true,
},
],
// "@lingui/babel-preset-react",
[
"@babel/preset-typescript"
]
],
plugins: [
"lodash",
"@babel/plugin-syntax-jsx",
[
"@babel/plugin-transform-react-jsx",
{
"throwIfNamespace": false, // defaults to true
"runtime": "automatic", // defaults to classic
// "importSource": "custom-jsx-library" // defaults to react
}
],
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-transform-react-constant-elements",
"macros",
"@umijs/babel-plugin-auto-css-modules",
// "babel-plugin-macros",
// [
// "babel-plugin-styled-components",
// {
// "transpileTemplateLiterals": false
// }
// ],
"@babel/plugin-syntax-dynamic-import",
[
"@babel/plugin-transform-runtime",
{
version: require("@babel/runtime/package.json").version,
absoluteRuntime: false,
corejs: 3,
helpers: true,
regenerator: true,
useESModules: true,
},
],
// [
// "import",
// // using antd UI
// {
// libraryName: "antd",
// libraryDirectory: "es",
// // style: 'css', // `style: true` 会加载 less 文件
// style: true,
// },
// // // using material-ui
// // {
// // "libraryName": "@material-ui/core",
// // "libraryDirectory": "components", // default: lib
// // "camel2DashComponentName": false // default: true
// // }
// ],
[
"@babel/plugin-proposal-class-properties",
{
loose: true,
}
],
"@babel/plugin-proposal-export-default-from",
[
"@babel/plugin-proposal-private-methods",
{
loose: true,
}
],
[
"@babel/plugin-proposal-private-property-in-object",
{
loose: true,
}
],
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
],
};