🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(vite): forward memberless @lobehub/ui barrel imports as a namespace (#19059)
Inneib03d467345a8
diff --git a/plugins/vite/lobeUiImports.test.ts b/plugins/vite/lobeUiImports.test.tsindex abd5b881e17..4a2212bd959 100644--- a/plugins/vite/lobeUiImports.test.ts+++ b/plugins/vite/lobeUiImports.test.ts@@ -14,6 +14,8 @@ const fixturePlugin: Plugin = {import { ConfigProvider, ErrorBoundary, Flexbox } from '@lobehub/ui';import { Button } from '@lobehub/ui/base-ui';export { ConfigProvider, ErrorBoundary, Flexbox, Button };+ export * from '@lobehub/ui/brand';+ export const loadToast = () => import('@lobehub/ui/base-ui');`;},resolveId(id) {@@ -73,5 +75,7 @@ describe('lobeUiImports', () => {expect(code).not.toMatch(/from ["']react-error-boundary["']/);expect(code).not.toMatch(/from ["']@lobehub\/ui["']/);expect(code).not.toMatch(/from ["']@lobehub\/ui\/base-ui["']/);+ expect(code).toContain('@lobehub/ui/es/brand/index');+ expect(code).toContain('@lobehub/ui/es/base-ui/index');});});diff --git a/plugins/vite/lobeUiImports.ts b/plugins/vite/lobeUiImports.tsindex 771fc4c8e4d..be827da9b79 100644--- a/plugins/vite/lobeUiImports.ts+++ b/plugins/vite/lobeUiImports.ts@@ -73,9 +73,13 @@ const namedExportProxy = (maps: Record<string, Barrel>): Plugin => ({if (!id.startsWith(RESOLVED_NAMED_EXPORT_PREFIX)) return;const [barrel, member] = id.slice(RESOLVED_NAMED_EXPORT_PREFIX.length).split(':');+ const barrelIndex = `@lobehub/ui/es/${barrel ? `${barrel}/` : ''}index`;+ // transform-imports rewrites `import()`, `export *` and side-effect imports+ // with an empty member, so there is no single export to forward.+ if (!member) return `export * from '${barrelIndex}';`;+const entry = maps[barrel]?.members[member];- if (!entry)- return `export { ${member} as default } from '@lobehub/ui/es/${barrel ? `${barrel}/` : ''}index';`;+ if (!entry) return `export { ${member} as default } from '${barrelIndex}';`;// Bare specifiers such as react-error-boundary are dependencies of// @lobehub/ui, not of the app, so they only resolve from the barrel's own