Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(icons): keep provider icon lazy exports initialized in production builds (#20315)

Innei0207cdb940bd
diff --git a/src/libs/providerIcon.ts b/src/libs/providerIcon.ts
index c1c9a0a1e77..b0453383a0b 100644
--- a/src/libs/providerIcon.ts
+++ b/src/libs/providerIcon.ts
@@ -1,5 +1,11 @@
-// eslint-disable-next-line no-restricted-imports -- the lazy wrapper in @/components/LobeIcons is the only importer
-import { ProviderCombine, ProviderIcon, providerMappings, Unsloth } from '@lobehub/icons';
+/* eslint-disable no-restricted-imports -- the lazy wrapper in @/components/LobeIcons is the only importer */
+import {
+ ProviderCombine as LobeProviderCombine,
+ ProviderIcon as LobeProviderIcon,
+ providerMappings,
+ Unsloth,
+} from '@lobehub/icons';
+/* eslint-enable no-restricted-imports */
/**
* @lobehub/icons 5.18 exports Unsloth but omits its provider mapping. Register
@@ -13,4 +19,9 @@ if (
providerMappings.push({ Icon: Unsloth, keywords: ['unsloth'] });
}
-export { ProviderCombine, ProviderIcon };
+// Do not turn these back into `export { ... }` re-exports: with rolldown's
+// strictExecutionOrder (rolldown 1.2.12) the icon modules' init wrappers are
+// then never called in production chunks, both exports stay undefined and the
+// lazy loaders in @/components/LobeIcons crash with React #306.
+export const ProviderIcon = LobeProviderIcon;
+export const ProviderCombine = LobeProviderCombine;