Skip to content

Commit edc2db9

Browse files
committed
fix: make it work when a default lang was specified
ref: vitejs/vite-plugin-vue@ff68ed3
1 parent ad14077 commit edc2db9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/core/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ async function genTemplateCode(
268268
// If the template is not using pre-processor AND is not using external src,
269269
// compile and inline it directly in the main module. When served in vite this
270270
// saves an extra request per SFC which can improve load performance.
271-
if (!template.lang && !template.src) {
271+
if ((!template.lang || template.lang === 'html') && !template.src) {
272272
return transformTemplateInMain(
273273
template.content,
274274
descriptor,

src/core/script.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export function canInlineMain(
113113
return false
114114
}
115115
const lang = descriptor.script?.lang || descriptor.scriptSetup?.lang
116-
if (!lang) {
116+
if (!lang || lang === 'js') {
117117
return true
118118
}
119119
if (

src/core/template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export function resolveTemplateCompilerOptions(
175175
ssr,
176176
ssrCssVars: cssVars,
177177
transformAssetUrls,
178-
preprocessLang: block.lang,
178+
preprocessLang: block.lang === 'html' ? undefined : block.lang,
179179
preprocessOptions,
180180
compilerOptions: {
181181
...options.template?.compilerOptions,

0 commit comments

Comments
 (0)