diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index 44b1de74721efd..1d554d69860b3d 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -268,7 +268,7 @@ async function genScriptCode( if (script) { // If the script is js/ts and has no external src, it can be directly placed // in the main module. - if ((!script.lang || script.lang === 'ts') && !script.src) { + if ((!script.lang || (script.lang === 'ts' && options.devServer)) && !script.src) { scriptCode = options.compiler.rewriteDefault( script.content, '_sfc_main',