]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
wip: avoid iife for vapor prod mode
authorEvan You <evan@vuejs.org>
Tue, 10 Dec 2024 00:35:54 +0000 (08:35 +0800)
committerEvan You <evan@vuejs.org>
Tue, 10 Dec 2024 00:35:54 +0000 (08:35 +0800)
packages/compiler-sfc/src/compileScript.ts
packages/compiler-vapor/src/generate.ts

index b43fc84f4785fd8655c141763f8cb31e271cd4f6..750770e20f45c685f5f42d03e625defc8b424ec4 100644 (file)
@@ -936,7 +936,11 @@ export function compileScript(
         `\n}\n\n`,
     )
   } else {
-    ctx.s.appendRight(endOffset, `\nreturn ${returned}\n}\n\n`)
+    ctx.s.appendRight(
+      endOffset,
+      // vapor mode generates its own return when inlined
+      `\n${vapor ? `` : `return `}${returned}\n}\n\n`,
+    )
   }
 
   // 10. finalize default export
index ee43be0912b507e3ff819fd76da5831b4e2bfebf..a134882351e2f3f95befce7e393cafca91babb3b 100644 (file)
@@ -111,7 +111,7 @@ export function generate(
   )
 
   if (inline) {
-    push(`((${signature}) => {`)
+    // push(`((${signature}) => {`)
   } else {
     push(NEWLINE, `export function ${functionName}(${signature}) {`)
   }
@@ -121,7 +121,7 @@ export function generate(
   push(INDENT_END, NEWLINE)
 
   if (inline) {
-    push('})()')
+    // push('})()')
   } else {
     push('}')
   }