From 76a04180be769b86dcb23713a493e087f73668a0 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Mon, 30 Nov 2020 15:20:21 +0800 Subject: [PATCH] fix(mocha): disable SSR optimization for Vue 3 testing (#6097) Fixes https://github.com/vuejs/vue-loader/issues/1734 --- packages/@vue/cli-plugin-unit-mocha/index.js | 12 +++++++----- packages/@vue/cli-service/package.json | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/@vue/cli-plugin-unit-mocha/index.js b/packages/@vue/cli-plugin-unit-mocha/index.js index cfdec0aa5f..ad1975a684 100644 --- a/packages/@vue/cli-plugin-unit-mocha/index.js +++ b/packages/@vue/cli-plugin-unit-mocha/index.js @@ -12,16 +12,18 @@ module.exports = api => { // when target === 'node', vue-loader will attempt to generate // SSR-optimized code. We need to turn that off here. - // the `optimizeSSR` option is only available in vue-loader 15 - if (!isVue3) { - webpackConfig.module + webpackConfig.module .rule('vue') .use('vue-loader') .tap(options => { - options.optimizeSSR = false + if (isVue3) { + options.isServerBuild = false + } else { + options.optimizeSSR = false + } + return options }) - } } }) diff --git a/packages/@vue/cli-service/package.json b/packages/@vue/cli-service/package.json index 9e30d1bfdb..5e5c993043 100644 --- a/packages/@vue/cli-service/package.json +++ b/packages/@vue/cli-service/package.json @@ -80,7 +80,7 @@ "webpack-merge": "^4.2.2" }, "optionalDependencies": { - "vue-loader-v16": "npm:vue-loader@^16.0.0-beta.7" + "vue-loader-v16": "npm:vue-loader@^16.1.0" }, "peerDependencies": { "@vue/compiler-sfc": "^3.0.0-beta.14",