Skip to content

Commit c0971ae

Browse files
author
winddies
committed
调整 babel 使用姿势
1 parent 7c296d8 commit c0971ae

File tree

3 files changed

+29
-30
lines changed

3 files changed

+29
-30
lines changed

.babelrc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,20 @@
33
[
44
"@babel/preset-env",
55
{
6-
"loose": true,
6+
"useBuiltIns": "usage", // 在文件需要的位置单独按需引入 polyfill
77
"targets": {
88
"browsers": ["last 2 versions", "ie >= 8"]
99
}
1010
}
1111
]
1212
],
13-
"plugins": ["@babel/transform-runtime", "@babel/plugin-proposal-object-rest-spread"]
13+
"plugins": [
14+
[
15+
"@babel/transform-runtime",
16+
{
17+
"corejs": 2
18+
}
19+
],
20+
"@babel/proposal-object-rest-spread"
21+
]
1422
}

package-lock.json

Lines changed: 15 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"@babel/preset-env": "^7.10.2",
3737
"babel-loader": "^8.1.0",
3838
"babel-plugin-syntax-flow": "^6.18.0",
39-
"babel-runtime": "^6.26.0",
4039
"body-parser": "^1.18.2",
4140
"connect-multiparty": "^2.1.0",
4241
"es3ify-webpack-plugin": "^0.1.0",
@@ -56,5 +55,8 @@
5655
"webpack-dev-server": "^3.11.0",
5756
"webpack-merge": "^4.2.2"
5857
},
59-
"license": "MIT"
58+
"license": "MIT",
59+
"dependencies": {
60+
"@babel/runtime-corejs2": "^7.10.2"
61+
}
6062
}

0 commit comments

Comments
 (0)