Skip to content

Commit a5a66c5

Browse files
committed
fix(compiler-sfc): fix script setup hidden flag codegen
1 parent ac853ff commit a5a66c5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/compiler-sfc/src/compileScript.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -946,11 +946,13 @@ export function compileScript(
946946
allBindings[key] = true
947947
}
948948
}
949-
returned = `{ ${Object.keys(allBindings).join(', ')}${
949+
const keys = Object.keys(allBindings)
950+
if (!__TEST__) {
950951
// the `__isScriptSetup: true` flag is used by componentPublicInstance
951952
// proxy to allow properties that start with $ or _
952-
__TEST__ ? `` : `, __isScriptSetup: true`
953-
} }`
953+
keys.push(`__isScriptSetup: true`)
954+
}
955+
returned = `{ ${keys.join(', ')} }`
954956
}
955957
s.appendRight(endOffset, `\nreturn ${returned}\n}\n\n`)
956958

0 commit comments

Comments
 (0)