]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler-sfc): fix script setup hidden flag codegen
authorEvan You <yyx990803@gmail.com>
Thu, 24 Jun 2021 14:11:30 +0000 (10:11 -0400)
committerEvan You <yyx990803@gmail.com>
Thu, 24 Jun 2021 14:11:30 +0000 (10:11 -0400)
packages/compiler-sfc/src/compileScript.ts

index f802bdffdd818b13f1e1329a4859eb6deff10001..a56888a1c29c8d630530e4a423387fd7ba1bcd7f 100644 (file)
@@ -946,11 +946,13 @@ export function compileScript(
         allBindings[key] = true
       }
     }
-    returned = `{ ${Object.keys(allBindings).join(', ')}${
+    const keys = Object.keys(allBindings)
+    if (!__TEST__) {
       // the `__isScriptSetup: true` flag is used by componentPublicInstance
       // proxy to allow properties that start with $ or _
-      __TEST__ ? `` : `, __isScriptSetup: true`
-    } }`
+      keys.push(`__isScriptSetup: true`)
+    }
+    returned = `{ ${keys.join(', ')} }`
   }
   s.appendRight(endOffset, `\nreturn ${returned}\n}\n\n`)