import { defineConfig } from 'vitepress' import { withMermaid } from 'vitepress-plugin-mermaid' const config = withMermaid( defineConfig({ // title: "Frontend Monorepo", title: 'Frontend Arch', description: "Centralized documentation for the Enterprise Frontend Monorepo", head: [ ['link', { rel: 'icon', href: '/favicon.svg' }] // Jika Anda menggunakan favicon.svg ], themeConfig: { search: { provider: 'local', options: { detailedView: true } }, logo: '/logo.svg', nav: [ { text: 'Docs', link: '/overview' }, ], sidebar: [ { text: 'Getting Started', items: [ { text: 'Project Overview', link: '/overview' }, { text: 'Development Setup', link: '/setup' }, ], }, { text: 'Core Architecture', collapsed: false, items: [ { text: 'API & Domain Logic', link: '/packages/core-api/' }, { text: 'Event Bus System', link: '/packages/core-events/' }, { text: 'Storage & Persistence', link: '/packages/core-storage/' }, { text: 'I18n & Localization', link: '/packages/core-i18n/' }, ], }, { text: 'UI System', collapsed: false, items: [ { text: 'Overview', link: '/packages/ui/' }, { text: 'App Layout', link: '/packages/ui/CORE-APP-SHELL' }, { text: 'Form Primitives', link: '/packages/ui/FORM-COMPONENTS' }, ], }, { text: 'Desktop Ecosystem', collapsed: false, items: [ { text: 'Overview', link: '/apps/desktop/' }, { text: 'Lifecycle & Configuration', link: '/apps/desktop/CONFIGURATION' }, { text: 'IPC & Bridge Architecture', link: '/apps/desktop/IPC_ARCHITECTURE' }, { text: 'Distribution & Auto-Update', link: '/apps/desktop/AUTO_UPDATER' }, ], }, ], outline: { level: [2, 3] }, socialLinks: [ { icon: { svg: 'Gitea' }, link: 'https://git.eigen.co.id/eigen/fe-monorepo-template' } ] }, // Mermaid configuration mermaid: { theme: 'default', }, // Fix cascading CJS/ESM SyntaxErrors caused by Vite dynamically discovering mermaid vite: { optimizeDeps: { include: [ 'mermaid' ] } } }) ); // Pnpm strict workspace workaround: // vitepress-plugin-mermaid aggressively injects sub-dependencies into optimizeDeps.include. // Because pnpm uses strict symlinks, Vite fails to resolve these sub-dependencies from the project root, // causing pre-bundling to fail and cascading CJS/ESM SyntaxErrors in the browser. // We strip them out so esbuild can naturally inline them into the 'mermaid' chunk instead. if (config.vite?.optimizeDeps?.include) { config.vite.optimizeDeps.include = config.vite.optimizeDeps.include.filter( (dep) => !['@braintree/sanitize-url', 'debug', 'cytoscape-cose-bilkent', 'cytoscape'].includes(dep) ); } export default config;