From: 三咲智子 Kevin Deng Date: Tue, 28 Mar 2023 08:27:34 +0000 (+0800) Subject: fix(compiler-sfc): fix edge case of default export call with no args (#7536) X-Git-Tag: v3.3.0-alpha.6~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d60e58c9f62ae7bd1f9c888cd2e55982a64d9e96;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-sfc): fix edge case of default export call with no args (#7536) closes #7534 --- diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap index 99f3395915..6220f860f1 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap @@ -59,6 +59,24 @@ return { n, get x() { return x } } }" `; +exports[`SFC compile + + + `) + assertCode(content) + }) }) describe('imports', () => { diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index f05926df92..c9fe242b25 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -1116,6 +1116,7 @@ export function compileScript( optionProperties = defaultExport.declaration.properties } else if ( defaultExport.declaration.type === 'CallExpression' && + defaultExport.declaration.arguments[0] && defaultExport.declaration.arguments[0].type === 'ObjectExpression' ) { optionProperties = defaultExport.declaration.arguments[0].properties