Skip to content

Commit abfb92b

Browse files
authored
chore: upgrade babel 7 (#17)
* chore: upgrade babel 7
1 parent 57da340 commit abfb92b

File tree

5 files changed

+51
-25
lines changed

5 files changed

+51
-25
lines changed

.babelrc

+29-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
11
{
2-
presets: [
3-
'react',
4-
'env',
5-
'stage-2'
2+
"presets": [
3+
"@babel/preset-react",
4+
"@babel/preset-env"
65
],
7-
plugins: [
8-
'transform-decorators-legacy',
9-
'transform-runtime'
6+
"plugins": [
7+
[
8+
"@babel/plugin-proposal-decorators",
9+
{
10+
"legacy": true
11+
}
12+
],
13+
[
14+
"@babel/plugin-transform-runtime",
15+
{
16+
"corejs": 2
17+
}
18+
],
19+
"@babel/plugin-syntax-dynamic-import",
20+
"@babel/plugin-syntax-import-meta",
21+
"@babel/plugin-proposal-class-properties",
22+
"@babel/plugin-proposal-json-strings",
23+
"@babel/plugin-proposal-function-sent",
24+
"@babel/plugin-proposal-export-namespace-from",
25+
"@babel/plugin-proposal-numeric-separator",
26+
"@babel/plugin-proposal-throw-expressions"
1027
],
11-
comments: false,
12-
env: {
13-
test: {
14-
plugins: [
15-
'istanbul'
28+
"comments": false,
29+
"env": {
30+
"test": {
31+
"plugins": [
32+
"istanbul"
1633
]
1734
}
1835
}

.eslintrc.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ module.exports = {
3939
"sourceType": "module",
4040
"ecmaFeatures": {
4141
"experimentalObjectRestSpread": true,
42-
"jsx": true
42+
"jsx": true,
43+
"legacyDecorators": true,
4344
}
4445
}
4546
};

antd-sample/common/fetch.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,6 @@ const request = (url, method = 'GET', params = {}) => {
6767
.then(res => res.json());
6868
};
6969

70-
module.exports = request;
71-
module.exports.fetch = fetch;
70+
request.fetch = fetch;
71+
72+
export default request;

package.json

+16-9
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,25 @@
2727
"contributor": "git-contributor"
2828
},
2929
"devDependencies": {
30+
"@babel/core": "^7.0.0",
31+
"@babel/plugin-proposal-class-properties": "^7.0.0",
32+
"@babel/plugin-proposal-decorators": "^7.0.0",
33+
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
34+
"@babel/plugin-proposal-function-sent": "^7.0.0",
35+
"@babel/plugin-proposal-json-strings": "^7.0.0",
36+
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
37+
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
38+
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
39+
"@babel/plugin-syntax-import-meta": "^7.0.0",
40+
"@babel/plugin-transform-runtime": "^7.0.0",
41+
"@babel/preset-env": "^7.0.0",
42+
"@babel/preset-react": "^7.0.0",
43+
"@babel/runtime-corejs2": "^7.0.0",
3044
"antd": "^3.13.2",
3145
"antd-mobile": "^2.1.8",
32-
"babel-core": "^6.26.0",
33-
"babel-eslint": "^8.2.2",
34-
"babel-loader": "^7.1.2",
46+
"babel-eslint": "^9.0.0",
47+
"babel-loader": "^8.0.0",
3548
"babel-plugin-istanbul": "^4.1.5",
36-
"babel-plugin-transform-decorators-legacy": "^1.3.4",
37-
"babel-plugin-transform-runtime": "^6.23.0",
38-
"babel-preset-env": "^1.3.2",
39-
"babel-preset-react": "^6.24.1",
40-
"babel-preset-stage-2": "^6.24.1",
41-
"babel-runtime": "^6.26.0",
4249
"classnames": "^2.2.5",
4350
"cross-env": "^5.1.1",
4451
"css-loader": "^0.28.8",

test/mocha.opts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
--reporter macaca-reporter
2-
--require babel-register
2+
--require @babel/register
33
--recursive
44
--timeout 60000

0 commit comments

Comments
 (0)