-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.babelrc
60 lines (60 loc) · 1.91 KB
/
.babelrc
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
// .babelrc
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"browsers": [
">0.2%",
"not dead",
"not op_mini all",
"last 2 versions",
"ie >= 8",
"iOS >= 8",
"Android >= 4"
]
},
"modules": false,
"useBuiltIns": "entry", // usage
"corejs": 3,
"debug": false, // 是否输出启用的plugins列表
"spec": false, // 是否允许more spec compliant,但可能转译出的代码更慢
"loose": true, // 是否允许生成更简单es5的代码,但可能不那么完全符合ES6语义
"include": [], // 总是启用的 plugins
"exclude": [], // 强制不启用的 plugins
"forceAllTransforms": false // 强制使用所有的plugins,用于只能支持ES5的uglify可以正确压缩代码
}
],
[
"@babel/preset-react",
{
// "pragma": "dom", // default pragma is React.createElement
// "pragmaFrag": "DomFrag", // default is React.Fragment
"throwIfNamespace": false
}
]
],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
[
// @babel/plugin-transform-runtime: 避免 polyfill 污染全局变量,减小打包体积
"@babel/plugin-transform-runtime",
{
// "polyfill": false,
"absoluteRuntime": false,
"corejs": 3, // 对应 @babel/runtime-corejs@3,需要填3
"helpers": false,
"regenerator": true,
"useESModules": false
}
],
["@babel/plugin-syntax-dynamic-import"],
["@babel/plugin-transform-modules-commonjs", {
"loose": true
}], // This plugin transforms ES2015 modules to CommonJS
["@babel/plugin-transform-arrow-functions", { "spec": false }],
["@babel/plugin-proposal-class-properties", { "loose": true }],
["react-hot-loader/babel"]
]
}