Skip to content

Commit

Permalink
perf: avoid parse repeatedly
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed May 24, 2024
1 parent d47eca5 commit c6b7352
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ async function doCompileScript(
inlineTemplate: true,
...store.sfcOptions?.script,
id,
genDefaultAs: COMP_IDENTIFIER,
templateOptions: {
...store.sfcOptions?.template,
ssr,
Expand All @@ -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)
Expand Down

0 comments on commit c6b7352

Please sign in to comment.