chore: update

This commit is contained in:
zhiyuanzmj 2025-05-24 07:22:09 +08:00
parent 066532d823
commit a9545418e7
2 changed files with 6 additions and 8 deletions

View File

@ -120,10 +120,7 @@ export default declare<VueJSXPluginOptions, BabelCore.PluginObj<State>>(
});
}
const vueImportMap: Record<
string,
(t.MemberExpression | t.Identifier)[]
> = {};
const vueImportMap: Record<string, t.Identifier[]> = {};
state.set('vueImportMap', vueImportMap);
path.node.body.forEach((statement) => {
if (t.isImportDeclaration(statement)) {

View File

@ -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;
}
}
}