diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap index 52bda6f4..de223bf9 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap @@ -1351,6 +1351,22 @@ return { } })" `; +exports[`SFC compile ` + ) + expect(content).toMatch(`return { Baz }`) + assertCode(content) + }) }) describe('async/await detection', () => { diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index 05623326..f70faeaf 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -802,7 +802,9 @@ export function compileScript( node.source.value, specifier.local.name, imported, - node.importKind === 'type', + node.importKind === 'type' || + (specifier.type === 'ImportSpecifier' && + specifier.importKind === 'type'), false ) } @@ -979,7 +981,9 @@ export function compileScript( source, local, imported, - node.importKind === 'type', + node.importKind === 'type' || + (specifier.type === 'ImportSpecifier' && + specifier.importKind === 'type'), true ) }