feat: add /ai nav entry; pre-bundle arcadia/phoenix deps to fix 504s

Adds an "AI" item to the sidebar nav (mirrors Vibespace's /ai route,
already wired in routes.ts). vite.config.ts now lists openapi-fetch,
phoenix, lucide-react, clsx, tailwind-merge, class-variance-authority
in optimizeDeps.include and adds explicit resolve.alias entries for
the arcadia and crema sibling libs so Vite resolves them on first
load instead of triggering a re-optimize mid-session.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
jules
2026-04-30 08:26:45 +10:00
parent b513fbe405
commit e7cb8c942b
2 changed files with 38 additions and 0 deletions

View File

@@ -89,6 +89,7 @@ const navItems: NavItem[] = [
{ to: "/", icon: LayoutDashboard, label: "Overview", end: true }, { to: "/", icon: LayoutDashboard, label: "Overview", end: true },
{ to: "/tenants", icon: Building2, label: "Tenants" }, { to: "/tenants", icon: Building2, label: "Tenants" },
{ to: "/activity", icon: Activity, label: "Audit log" }, { to: "/activity", icon: Activity, label: "Audit log" },
{ to: "/ai", icon: Bot, label: "AI" },
{ to: "/settings", icon: Settings, label: "Settings" }, { to: "/settings", icon: Settings, label: "Settings" },
// CREMA:NAV-ITEMS // CREMA:NAV-ITEMS
] ]

View File

@@ -50,6 +50,21 @@ const codeUiSrc = fileURLToPath(
const aiUiSrc = fileURLToPath( const aiUiSrc = fileURLToPath(
new URL("../lib-ai-ui/src", import.meta.url), new URL("../lib-ai-ui/src", import.meta.url),
) )
const authUiSrc = fileURLToPath(
new URL("../lib-auth-ui/src", import.meta.url),
)
const tableUiSrc = fileURLToPath(
new URL("../lib-table-ui/src", import.meta.url),
)
const searchUiSrc = fileURLToPath(
new URL("../lib-search-ui/src", import.meta.url),
)
const arcadiaClientSrc = fileURLToPath(
new URL("../lib-arcadia-client/src", import.meta.url),
)
const arcadiaAuthUiSrc = fileURLToPath(
new URL("../lib-arcadia-auth-ui/src", import.meta.url),
)
// Sibling lib packages (lib-content-ui, lib-content-editor-ui) import bare // Sibling lib packages (lib-content-ui, lib-content-editor-ui) import bare
// deps like clsx and @tiptap/* but have no node_modules of their own. Pin // deps like clsx and @tiptap/* but have no node_modules of their own. Pin
@@ -60,6 +75,8 @@ const aliasedDeps = [
"clsx", "clsx",
"tailwind-merge", "tailwind-merge",
"lucide-react", "lucide-react",
"openapi-fetch",
"phoenix",
"@tiptap/core", "@tiptap/core",
"@tiptap/react", "@tiptap/react",
"@tiptap/starter-kit", "@tiptap/starter-kit",
@@ -96,10 +113,30 @@ export default defineConfig({
"@crema/calendar-ui": `${calendarUiSrc}/index.tsx`, "@crema/calendar-ui": `${calendarUiSrc}/index.tsx`,
"@crema/code-ui": `${codeUiSrc}/index.tsx`, "@crema/code-ui": `${codeUiSrc}/index.tsx`,
"@crema/ai-ui": `${aiUiSrc}/index.tsx`, "@crema/ai-ui": `${aiUiSrc}/index.tsx`,
"@crema/auth-ui": `${authUiSrc}/index.tsx`,
"@crema/table-ui": `${tableUiSrc}/index.tsx`,
"@crema/search-ui": `${searchUiSrc}/index.tsx`,
"@crema/arcadia-client": `${arcadiaClientSrc}/index.tsx`,
"@crema/arcadia-auth-ui": `${arcadiaAuthUiSrc}/index.tsx`,
...sharedDepAliases, ...sharedDepAliases,
}, },
dedupe: dedupeDeps, dedupe: dedupeDeps,
}, },
// Pre-bundle deps that sibling libs reach for. Without this, Vite
// discovers them lazily as routes are hit and re-runs the optimizer,
// invalidating already-served module URLs (browser sees 504 "Outdated
// Optimize Dep"). Listing them here forces one optimizer pass on
// startup so the cache is stable before the browser connects.
optimizeDeps: {
include: [
"openapi-fetch",
"phoenix",
"lucide-react",
"clsx",
"tailwind-merge",
"class-variance-authority",
],
},
server: { server: {
fs: { fs: {
allow: [fileURLToPath(new URL("..", import.meta.url))], allow: [fileURLToPath(new URL("..", import.meta.url))],