Skip to content

Commit

Permalink
fixup! fix: compatibility with Vue 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang committed Jun 16, 2022
1 parent a648958 commit fcf27e3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/@vue/cli-service/lib/config/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,19 @@ module.exports = (api, options) => {

if (vueMajor === 2) {
// for Vue 2 projects
const vueLoaderCacheConfig = api.genCacheConfig('vue-loader', {
const partialIdentifier = {
'vue-loader': require('@vue/vue-loader-v15/package.json').version,
'@vue/component-compiler-utils': require('@vue/component-compiler-utils/package.json').version,
})
'@vue/component-compiler-utils': require('@vue/component-compiler-utils/package.json').version
}

try {
vueLoaderCacheConfig['vue-template-compiler'] = require('vue-template-compiler/package.json').version
partialIdentifier['vue-template-compiler'] = require('vue-template-compiler/package.json').version
} catch (e) {
// For Vue 2.7 projects, `vue-template-compiler` is not required
}

const vueLoaderCacheConfig = api.genCacheConfig('vue-loader', partialIdentifier)

webpackConfig.resolve
.alias
.set(
Expand Down

0 comments on commit fcf27e3

Please sign in to comment.