Skip to content

Commit

Permalink
fix: ensure correct vue reference in compiled templates
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 2, 2020
1 parent 96c8b60 commit f26b8a7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/node/server/serverPluginVue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit f26b8a7

Please sign in to comment.