diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index c43886fc..be5b5610 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -264,7 +264,7 @@ async function genTemplateCode( // If the template is not using pre-processor AND is not using external src, // compile and inline it directly in the main module. When served in vite this // saves an extra request per SFC which can improve load performance. - if (!template.lang && !template.src) { + if ((!template.lang || template.lang === 'html') && !template.src) { return transformTemplateInMain( template.content, descriptor, diff --git a/packages/plugin-vue/src/script.ts b/packages/plugin-vue/src/script.ts index f62a31e1..f9627faf 100644 --- a/packages/plugin-vue/src/script.ts +++ b/packages/plugin-vue/src/script.ts @@ -105,7 +105,7 @@ export function canInlineMain( return false } const lang = descriptor.script?.lang || descriptor.scriptSetup?.lang - if (!lang) { + if (!lang || lang === 'js') { return true } if (lang === 'ts' && options.devServer) { diff --git a/packages/plugin-vue/src/template.ts b/packages/plugin-vue/src/template.ts index 0f9b7fb8..d3a6350d 100644 --- a/packages/plugin-vue/src/template.ts +++ b/packages/plugin-vue/src/template.ts @@ -176,7 +176,7 @@ export function resolveTemplateCompilerOptions( ssr, ssrCssVars: cssVars, transformAssetUrls, - preprocessLang: block.lang, + preprocessLang: block.lang === 'html' ? undefined : block.lang, preprocessOptions, compilerOptions: { ...options.template?.compilerOptions, diff --git a/playground/vue/DefaultLangs.vue b/playground/vue/DefaultLangs.vue new file mode 100644 index 00000000..43f022f8 --- /dev/null +++ b/playground/vue/DefaultLangs.vue @@ -0,0 +1,16 @@ + + + + + diff --git a/playground/vue/Main.vue b/playground/vue/Main.vue index b587c916..9ab11aac 100644 --- a/playground/vue/Main.vue +++ b/playground/vue/Main.vue @@ -29,6 +29,7 @@ +