@@ -1183,7 +1183,7 @@ export function compileScript(
1183
1183
s . prependLeft ( startOffset , `\nlet __temp${ any } , __restore${ any } \n` )
1184
1184
}
1185
1185
1186
- const destructureElements = [ `expose` ]
1186
+ const destructureElements = hasDefineExposeCall ? [ `expose` ] : [ ]
1187
1187
if ( emitIdentifier ) {
1188
1188
destructureElements . push (
1189
1189
emitIdentifier === `emit` ? `emit` : `emit: ${ emitIdentifier } `
@@ -1256,9 +1256,6 @@ export function compileScript(
1256
1256
runtimeOptions += genRuntimeEmits ( typeDeclaredEmits )
1257
1257
}
1258
1258
1259
- // <script setup> components are closed by default. If the user did not
1260
- // explicitly call `defineExpose`, call expose() with no args.
1261
- const exposeCall = hasDefineExposeCall ? `` : ` expose();\n`
1262
1259
// wrap setup code with function.
1263
1260
if ( isTS ) {
1264
1261
// for TS, make sure the exported type is still valid type with
@@ -1273,7 +1270,7 @@ export function compileScript(
1273
1270
`defineComponent`
1274
1271
) } ({${ def } ${ runtimeOptions } \n ${
1275
1272
hasAwait ? `async ` : ``
1276
- } setup(${ args } ) {\n${ exposeCall } `
1273
+ } setup(${ args } ) {\n`
1277
1274
)
1278
1275
s . appendRight ( endOffset , `})` )
1279
1276
} else {
@@ -1283,14 +1280,14 @@ export function compileScript(
1283
1280
s . prependLeft (
1284
1281
startOffset ,
1285
1282
`\nexport default /*#__PURE__*/Object.assign(${ DEFAULT_VAR } , {${ runtimeOptions } \n ` +
1286
- `${ hasAwait ? `async ` : `` } setup(${ args } ) {\n${ exposeCall } `
1283
+ `${ hasAwait ? `async ` : `` } setup(${ args } ) {\n`
1287
1284
)
1288
1285
s . appendRight ( endOffset , `})` )
1289
1286
} else {
1290
1287
s . prependLeft (
1291
1288
startOffset ,
1292
1289
`\nexport default {${ runtimeOptions } \n ` +
1293
- `${ hasAwait ? `async ` : `` } setup(${ args } ) {\n${ exposeCall } `
1290
+ `${ hasAwait ? `async ` : `` } setup(${ args } ) {\n`
1294
1291
)
1295
1292
s . appendRight ( endOffset , `}` )
1296
1293
}
0 commit comments