Skip to content

Commit

Permalink
fix: don't inline template when __VUE_PROD_DEVTOOLS__
Browse files Browse the repository at this point in the history
ref: 277a3abde086d8e12f5097c47913fa5f1fbf3c23
  • Loading branch information
sxzz committed Jul 23, 2024
1 parent f9b6339 commit e83ae1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function transformMain(

// template
const hasTemplateImport =
descriptor.template && !isUseInlineTemplate(options, descriptor)
descriptor.template && !isUseInlineTemplate(descriptor, options)

let templateCode = ''
let templateMap: RawSourceMap | undefined
Expand Down
5 changes: 3 additions & 2 deletions src/core/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ export function setResolvedScript(
// inside <script setup>. This can only be done for build because
// inlined template cannot be individually hot updated.
export function isUseInlineTemplate(
options: ResolvedOptions,
descriptor: SFCDescriptor,
options: ResolvedOptions,
): boolean {
return (
options.inlineTemplate &&
!options.devServer &&
!options.devToolsEnabled &&
!!descriptor.scriptSetup &&
!descriptor.template?.src
)
Expand Down Expand Up @@ -72,7 +73,7 @@ export function resolveScript(
...options.script,
id: descriptor.id,
isProd: options.isProduction,
inlineTemplate: isUseInlineTemplate(options, descriptor),
inlineTemplate: isUseInlineTemplate(descriptor, options),
templateOptions: resolveTemplateCompilerOptions(descriptor, options, ssr),
sourceMap: options.sourceMap,
genDefaultAs: canInlineMain(framework, descriptor, options)
Expand Down

0 comments on commit e83ae1d

Please sign in to comment.