Skip to content

Commit c6764bf

Browse files
committed
build(babel): upgrade from babel 6 to babel 7
Upgrade the babel config from babel 6 to babel 7. This includes a few subset of changes. The vue-flow preset has been removed in favor or direct plugin installation, including 'transform-flow-strip-types', 'syntax-flow', and ' proposal-class-properties'. Use of 'transform-vue-jsx' plugin, using @vue/babel-plugin-transform-vue-jsx and @vue/babel-helper-vue-jsx-merge-props to gain babel 7 support Use proposal decorators with legacy decorators option set to true. This requires options to be set in the babel-eslint to support since legacy behavior is deprecated. Use loose interpretation for proposal class properties to support legacy proposal decorators. Proposal decorators must come before class properties in plugin declaration There were many stage-2 plugins that are not being used and were not installed: 'proposal-export-namespace-from' 'proposal-function-sent' 'proposal-json-strings' 'proposal-numeric-separator' 'proposal-throw-expressions' 'syntax-import-meta' @babel/polyfill now replaces babel-polyfill. @babel/polyfill is currently deprecated, and should be replaced in a future PR. Please see https://babeljs.io/docs/en/babel-polyfill for more details
1 parent ef6f166 commit c6764bf

File tree

7 files changed

+1310
-809
lines changed

7 files changed

+1310
-809
lines changed

Diff for: .babelrc

-5
This file was deleted.

Diff for: .eslintrc

+6
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,11 @@
1818
"space-before-function-paren": 0,
1919
"object-curly-spacing": 0,
2020
"indent": 0
21+
},
22+
"parserOptions": {
23+
"parser": "babel-eslint",
24+
"ecmaFeatures": {
25+
"legacyDecorators": true
26+
}
2127
}
2228
}

Diff for: babel.config.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
presets: ['@babel/preset-env', '@vue/babel-preset-jsx'],
3+
plugins: [
4+
'@babel/plugin-syntax-jsx',
5+
'@babel/plugin-transform-flow-strip-types',
6+
'@babel/plugin-syntax-flow',
7+
['@babel/plugin-proposal-decorators', { legacy: true }],
8+
['@babel/plugin-proposal-class-properties', { loose: true }]
9+
],
10+
comments: false
11+
}

Diff for: package.json

+12-11
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,18 @@
3232
"test:types": "tsc -p packages/test-utils/types && tsc -p packages/server-test-utils/types"
3333
},
3434
"dependencies": {
35-
"babel-core": "^6.26.0",
36-
"babel-eslint": "^8.2.2",
37-
"babel-helper-vue-jsx-merge-props": "^2.0.3",
38-
"babel-loader": "^7.1.3",
39-
"babel-plugin-syntax-jsx": "^6.18.0",
40-
"babel-plugin-transform-decorators-legacy": "^1.3.4",
41-
"babel-plugin-transform-vue-jsx": "^3.7.0",
42-
"babel-polyfill": "^6.26.0",
43-
"babel-preset-env": "^1.6.0",
44-
"babel-preset-flow-vue": "^1.0.0",
45-
"babel-preset-stage-2": "^6.24.1",
35+
"@babel/core": "^7.0.0",
36+
"babel-eslint": "^9.0.0",
37+
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
38+
"@vue/babel-preset-jsx": "^1.1.2",
39+
"babel-loader": "^8.0.0",
40+
"@babel/plugin-syntax-jsx": "^7.0.0",
41+
"@babel/plugin-proposal-decorators": "^7.0.0",
42+
"@babel/plugin-transform-flow-strip-types": "^7.0.0",
43+
"@babel/plugin-proposal-class-properties": "^7.0.0",
44+
"@babel/plugin-syntax-flow": "^7.0.0",
45+
"@babel/polyfill": "^7.0.0",
46+
"@babel/preset-env": "^7.0.0",
4647
"chai": "^4.0.0",
4748
"chalk": "^2.4.2",
4849
"conditional-specs": "^1.0.1",

Diff for: test/setup/karma.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = function(config) {
66
frameworks: ['mocha', 'sinon-chai'],
77
reporters: ['spec'],
88
files: [
9-
'../../node_modules/babel-polyfill/dist/polyfill.js',
9+
'../../node_modules/@babel/polyfill/dist/polyfill.js',
1010
'./polyfills.js',
1111
'load-tests.js'
1212
],

Diff for: test/setup/mocha.setup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require('babel-polyfill')
1+
require('@babel/polyfill')
22

33
if (process.env.TEST_ENV !== 'node') {
44
require('jsdom-global')()

0 commit comments

Comments
 (0)