Skip to content

Commit b824d13

Browse files
committed
feature #1134 Add vue 2.7 feature (billyct)
This PR was merged into the main branch. Discussion ---------- Add vue 2.7 feature https://blog.vuejs.org/posts/vue-2-7-naruto.html With `vue 2.7` released, so i try to upgrade my app to `vue 2.7`. and followed the upgrade guide, after I removed the package `vue-template-compiler` > Upgrade vue to ^2.7.0. You can also remove vue-template-compiler from the dependencies - it is no longer needed in 2.7. it shows me the error ``` Error: Install vue-template-compiler to use enableVueLoader( ) yarn add vue-template-compiler --dev ``` so add a special feature named `vue2.7` Commits ------- ab2c368 Add vue 2.7 feature
2 parents 5ab81d9 + ab2c368 commit b824d13

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

lib/config-generator.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ class ConfigGenerator {
132132
const vueVersion = getVueVersion(this.webpackConfig);
133133
switch (vueVersion) {
134134
case 2:
135+
case '2.7':
135136
config.resolve.alias['vue$'] = 'vue/dist/vue.esm.js';
136137
break;
137138
case 3:

lib/features.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ const features = {
9797
],
9898
description: 'load Vue files'
9999
},
100+
'vue2.7': {
101+
method: 'enableVueLoader()',
102+
// vue is needed so the end-user can do things
103+
packages: [
104+
{ name: 'vue', version: '^2.7' },
105+
{ name: 'vue-loader', version: '^15.10.0' },
106+
],
107+
description: 'load Vue files'
108+
},
100109
vue3: {
101110
method: 'enableVueLoader()',
102111
// vue is needed so the end-user can do things

lib/utils/get-vue-version.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const logger = require('../logger');
1616

1717
/**
1818
* @param {WebpackConfig} webpackConfig
19-
* @return {int|null}
19+
* @return {int|string|null}
2020
*/
2121
module.exports = function(webpackConfig) {
2222
if (webpackConfig.vueOptions.version !== null) {
@@ -30,6 +30,10 @@ module.exports = function(webpackConfig) {
3030
return 2;
3131
}
3232

33+
if (semver.satisfies(vueVersion, '^2.7')) {
34+
return '2.7';
35+
}
36+
3337
if (semver.satisfies(vueVersion, '^2')) {
3438
return 2;
3539
}

0 commit comments

Comments
 (0)