From 9897d9889e5793befe94da0189c93bf1e641d4e5 Mon Sep 17 00:00:00 2001 From: Li Zhequ Date: Fri, 14 Oct 2022 05:18:22 +0800 Subject: [PATCH] fix(plugin-vue): enable ts in template when using tsx in dev mode (#10180) --- packages/plugin-vue/src/main.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index 5d76256f..64ad9346 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -213,9 +213,11 @@ export async function transformMain( // handle TS transpilation let resolvedCode = output.join('\n') + const lang = descriptor.scriptSetup?.lang || descriptor.script?.lang + if ( - (descriptor.script?.lang === 'ts' || - descriptor.scriptSetup?.lang === 'ts') && + lang && + /tsx?$/.test(lang) && !descriptor.script?.src // only normal script can have src ) { const { code, map } = await transformWithEsbuild(