From a9545418e7fc3409ada3298e7df7064cdcaa48f4 Mon Sep 17 00:00:00 2001 From: zhiyuanzmj <260480378@qq.com> Date: Sat, 24 May 2025 07:22:09 +0800 Subject: [PATCH] chore: update --- packages/babel-plugin-jsx/src/index.ts | 5 +---- packages/babel-plugin-jsx/src/utils.ts | 9 +++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/babel-plugin-jsx/src/index.ts b/packages/babel-plugin-jsx/src/index.ts index a2973a6..8daaf6d 100644 --- a/packages/babel-plugin-jsx/src/index.ts +++ b/packages/babel-plugin-jsx/src/index.ts @@ -120,10 +120,7 @@ export default declare>( }); } - const vueImportMap: Record< - string, - (t.MemberExpression | t.Identifier)[] - > = {}; + const vueImportMap: Record = {}; state.set('vueImportMap', vueImportMap); path.node.body.forEach((statement) => { if (t.isImportDeclaration(statement)) { diff --git a/packages/babel-plugin-jsx/src/utils.ts b/packages/babel-plugin-jsx/src/utils.ts index 49867f9..2117b21 100644 --- a/packages/babel-plugin-jsx/src/utils.ts +++ b/packages/babel-plugin-jsx/src/utils.ts @@ -38,10 +38,11 @@ export const shouldTransformedToSlots = (tag: string, state?: State) => { if (state) { const vueImportMap = state.get('vueImportMap'); for (const name of [FRAGMENT, KEEP_ALIVE]) { - if (vueImportMap[name]) { - if (vueImportMap[name].some((id: t.Identifier) => id.name === tag)) { - return false; - } + if ( + vueImportMap[name] && + vueImportMap[name].some((id: t.Identifier) => id.name === tag) + ) { + return false; } } }