From fcf27e350e743a2fbc99d4c021dcd49e43cac929 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 16 Jun 2022 20:22:32 +0800 Subject: [PATCH] fixup! fix: compatibility with Vue 2.7 --- packages/@vue/cli-service/lib/config/base.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/@vue/cli-service/lib/config/base.js b/packages/@vue/cli-service/lib/config/base.js index 84bbfeddaa..5326590e8a 100644 --- a/packages/@vue/cli-service/lib/config/base.js +++ b/packages/@vue/cli-service/lib/config/base.js @@ -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(