-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.config.js
57 lines (55 loc) · 1.81 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
53
54
55
56
57
export default {
// root: path.resolve(__dirname, '../../../node_modules'),
// rootMode: "upward",
// assumptions: {
// privateFieldsAsProperties: true,
// },
// browserslistConfigFile: path.resolve(__dirname, './.browserslistrc'),
"presets": [
[
// "@babel/preset-env", // 在link时不能正确找到才用相对路经去寻找
"@babel/preset-env",
{
"modules": false,
"useBuiltIns": "usage", // 代替 "@babel/plugin-transform-runtime"配置
"corejs": 3,
}
],
[
"@babel/preset-typescript"
],
// [
// "@babel/preset-react"
// ],
],
"plugins": [
// [
// "@babel/plugin-transform-runtime",
// {
// "corejs": 3
// }
// ],
[
// '@babel/plugin-proposal-decorators',
'@babel/plugin-proposal-decorators',
{ legacy: true } // 装饰器语法处理
],
[
'@babel/plugin-proposal-class-properties',
// '@babel/plugin-proposal-class-properties',
// { loose: true },
],
[
// '@babel/plugin-proposal-object-rest-spread' // 对象rest、spread语法处理
'@babel/plugin-proposal-object-rest-spread',
],
// "@babel/plugin-syntax-dynamic-import"
// "@babel/plugin-syntax-dynamic-import",
]
}
/***
*
* 注释:@babel/preset-env 的useBuiltIns:entrey 和 @babel/plugin-transform-runtime不能同时开启,同时开启,两个polyfill都会打包进去
* @babel/preset-env是在文件开头引用适合开发application,runtime是按需加载适合开发库,但是有node运行时的项目适合应runtime
*
*/