-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.babelrc
37 lines (37 loc) · 1.21 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
{
"presets": [
[
"@babel/preset-env",
{
// 将es6的语法翻译成es5语法
"targets": {
//兼容目标浏览器
//"chrome": "67", //指定浏览器版本
//"browsers": ["last 2 versions", "safari >= 7"], //支持每个浏览器最后两个版本和safari大于等于7版本所需的polyfill代码转换
"browsers": "> 5%", //支持市场份额超过5%的浏览器
"node": "current" //如果通过Babel编译Node.js代码的话,可以设置 "target.node" 是 'current', 含义是 支持的是当前运行版本的nodejs。
},
"useBuiltIns": "usage", // 做@babel/polyfill补充时,按需补充,用到什么才补充什么,例:只转换用到的es6语法.
"corejs": "3" //声明corejs版本
}
],
"@babel/preset-react" //转换react JSX
],
"plugins": [
[
"@babel/plugin-proposal-decorators", //解析装饰器@
{
"legacy": true
}
],
[
"import",
{
//使用babel-plugin-import来实现按需加载的效果
"libraryName": "antd",
"libraryDirectory": "es",
"style": "css" // `style: true` 会加载 less 文件
}
]
]
}