From c6b735298d5ab630cdc130aad7b8acaf7c9c41bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Fri, 24 May 2024 16:23:14 +0800 Subject: [PATCH] perf: avoid parse repeatedly --- src/transform.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/transform.ts b/src/transform.ts index ad3ca37d..27f0f63d 100644 --- a/src/transform.ts +++ b/src/transform.ts @@ -247,6 +247,7 @@ async function doCompileScript( inlineTemplate: true, ...store.sfcOptions?.script, id, + genDefaultAs: COMP_IDENTIFIER, templateOptions: { ...store.sfcOptions?.template, ssr, @@ -265,13 +266,7 @@ async function doCompileScript( 2, )} */` } - code += - `\n` + - store.compiler.rewriteDefault( - compiledScript.content, - COMP_IDENTIFIER, - expressionPlugins, - ) + code += `\n${compiledScript.content}` if ((descriptor.script || descriptor.scriptSetup)!.lang === 'ts') { code = await transformTS(code)