From f26b8a7f607fd5402da8ccfa4c41bf747d55a9b3 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 2 Jun 2020 14:42:40 -0400 Subject: [PATCH] fix: ensure correct vue reference in compiled templates --- src/node/server/serverPluginVue.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/node/server/serverPluginVue.ts b/src/node/server/serverPluginVue.ts index cdff0119e04269..6764b68681fc25 100644 --- a/src/node/server/serverPluginVue.ts +++ b/src/node/server/serverPluginVue.ts @@ -10,7 +10,7 @@ import { SFCStyleCompileResults, CompilerOptions } from '@vue/compiler-sfc' -import { resolveCompiler } from '../utils/resolveVue' +import { resolveCompiler, resolveVue } from '../utils/resolveVue' import hash_sum from 'hash-sum' import LRUCache from 'lru-cache' import { @@ -503,7 +503,11 @@ function compileSFCTemplate( compilerOptions: { ...userOptions, scopeId: scoped ? `data-v-${hash_sum(publicPath)}` : null, - runtimeModuleName: '/@modules/vue' + runtimeModuleName: resolveVue(root).isLocal + ? // in local mode, vue would have been optimized so must be referenced + // with .js postfix + '/@modules/vue.js' + : '/@modules/vue' }, preprocessLang: template.lang, preprocessCustomRequire: (id: string) => require(resolveFrom(root, id))