51925e955f
Everything sat in the eager startup graph (App.tsx statically imported all 28
routes; the editor pulled TipTap + KaTeX + ~45 lowlight grammars + drawio;
posthog + AI SDK loaded for everyone) — a /login visitor downloaded+compiled the
whole editor. Client-only; functionality 1:1, only WHEN code loads changed.
Result (prod build): eager JS 3.5MB -> ~1.12MB, entry 1920KB -> 552KB; KaTeX
(250KB) and the TipTap engine (~586KB) are now lazy chunks, off the startup path.
- App.tsx: route-level React.lazy + Suspense (editor Page, all settings/*, share,
space/home routes). Auth/redirect/cold-start routes stay eager. Suspense lives
inside Layout/ShareLayout around the Outlet so the shell stays mounted.
- Lazy KaTeX node views (math-inline-lazy/math-block-lazy) + lazy drawio
(drawio-view-lazy/drawio-menu-lazy), mirroring mermaid/excalidraw, each with a
node-sized Suspense placeholder so a slow chunk can't crash the editor.
- posthog-js is now a conditional dynamic import under the unchanged
isCloud() && isPostHogEnabled gate — self-hosted never downloads it.
- AiChatWindow is React.lazy, mounted on first open and kept mounted (a live AI
stream isn't torn down); renders null while closed (identical behavior).
- Cut eager TipTap pulls from always-loaded shell modules: editor-atoms /
global-bridge Editor -> import type; Aside lazily loaded (page routes only);
config.ts sanitizeUrl and use-clipboard execCommandCopy moved to client-local
src/lib/{sanitize-url,copy-to-clipboard}.ts (byte-identical to the editor-ext
originals, dropping the barrel's top-level @tiptap import); WebSocketStatus
import replaced with the "connected" literal the status atom already stores.
- vite.config.ts: a vendor-katex chunk group (TipTap/PM/Yjs intentionally NOT
grouped — grouping dragged the engine eager; documented in the config).
- lowlight grammar registration is left inside the (now-lazy) editor chunk:
listLanguages()/highlighting are synchronous, so deferring registration would
change behavior for marginal in-chunk gain — the route split already removes it
from startup, which was the complaint.
Gate: client build succeeds, tsc --noEmit clean, frozen install EXIT 0 (added
@braintree/sanitize-url as a direct client dep + regenerated the lock).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
104 lines
3.2 KiB
JSON
104 lines
3.2 KiB
JSON
{
|
|
"name": "client",
|
|
"private": true,
|
|
"version": "0.94.1",
|
|
"scripts": {
|
|
"dev": "node scripts/copy-vad-assets.mjs && vite",
|
|
"build": "node scripts/copy-vad-assets.mjs && tsc && vite build",
|
|
"lint": "eslint .",
|
|
"preview": "vite preview",
|
|
"format": "prettier --write \"src/**/*.tsx\" \"src/**/*.ts\"",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest"
|
|
},
|
|
"dependencies": {
|
|
"@ai-sdk/react": "^3.0.208",
|
|
"@braintree/sanitize-url": "7.1.2",
|
|
"@atlaskit/pragmatic-drag-and-drop": "1.8.1",
|
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "2.1.5",
|
|
"@atlaskit/pragmatic-drag-and-drop-flourish": "2.0.15",
|
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "1.1.0",
|
|
"@atlaskit/pragmatic-drag-and-drop-live-region": "1.3.4",
|
|
"@casl/react": "5.0.1",
|
|
"@docmost/editor-ext": "workspace:*",
|
|
"@excalidraw/excalidraw": "0.18.0-3a5ef40",
|
|
"@mantine/core": "8.3.18",
|
|
"@mantine/dates": "8.3.18",
|
|
"@mantine/form": "8.3.18",
|
|
"@mantine/hooks": "8.3.18",
|
|
"@mantine/modals": "8.3.18",
|
|
"@mantine/notifications": "8.3.18",
|
|
"@mantine/spotlight": "8.3.18",
|
|
"@ricky0123/vad-web": "^0.0.30",
|
|
"@slidoapp/emoji-mart": "5.8.7",
|
|
"@slidoapp/emoji-mart-data": "1.2.4",
|
|
"@slidoapp/emoji-mart-react": "1.1.5",
|
|
"@tabler/icons-react": "3.40.0",
|
|
"@tanstack/react-query": "5.90.17",
|
|
"@tanstack/react-virtual": "3.13.24",
|
|
"ai": "6.0.207",
|
|
"alfaaz": "1.1.0",
|
|
"axios": "1.16.0",
|
|
"blueimp-load-image": "5.16.0",
|
|
"clsx": "2.1.1",
|
|
"diff": "8.0.3",
|
|
"dompurify": "3.4.1",
|
|
"file-saver": "2.0.5",
|
|
"highlightjs-sap-abap": "0.3.0",
|
|
"i18next": "25.10.1",
|
|
"i18next-http-backend": "3.0.6",
|
|
"jotai": "2.18.1",
|
|
"jotai-optics": "0.4.0",
|
|
"js-cookie": "3.0.7",
|
|
"jwt-decode": "4.0.0",
|
|
"katex": "0.16.40",
|
|
"lowlight": "3.3.0",
|
|
"mantine-form-zod-resolver": "1.3.0",
|
|
"mermaid": "11.15.0",
|
|
"mitt": "3.0.1",
|
|
"onnxruntime-web": "^1.27.0",
|
|
"posthog-js": "1.372.2",
|
|
"react": "18.3.1",
|
|
"react-clear-modal": "^2.0.18",
|
|
"react-dom": "^18.3.1",
|
|
"react-drawio": "1.0.7",
|
|
"react-error-boundary": "6.1.1",
|
|
"react-helmet-async": "3.0.0",
|
|
"react-i18next": "16.5.8",
|
|
"react-router-dom": "7.13.1",
|
|
"semver": "7.7.4",
|
|
"socket.io-client": "4.8.3",
|
|
"zod": "4.3.6"
|
|
},
|
|
"devDependencies": {
|
|
"@eslint/js": "9.28.0",
|
|
"@tanstack/eslint-plugin-query": "5.94.4",
|
|
"@testing-library/jest-dom": "6.6.0",
|
|
"@testing-library/react": "16.1.0",
|
|
"@types/blueimp-load-image": "5.16.6",
|
|
"@types/file-saver": "2.0.7",
|
|
"@types/js-cookie": "3.0.6",
|
|
"@types/katex": "0.16.8",
|
|
"@types/node": "22.19.1",
|
|
"@types/react": "18.3.12",
|
|
"@types/react-dom": "18.3.1",
|
|
"@vitejs/plugin-react": "6.0.1",
|
|
"@vitest/coverage-v8": "4.1.6",
|
|
"eslint": "9.28.0",
|
|
"eslint-plugin-react": "7.37.5",
|
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
"eslint-plugin-react-refresh": "0.5.2",
|
|
"globals": "15.13.0",
|
|
"jsdom": "25.0.0",
|
|
"optics-ts": "2.4.1",
|
|
"postcss": "8.5.14",
|
|
"postcss-preset-mantine": "1.18.0",
|
|
"postcss-simple-vars": "7.0.1",
|
|
"prettier": "3.8.1",
|
|
"typescript": "5.9.3",
|
|
"typescript-eslint": "8.57.1",
|
|
"vite": "8.0.5",
|
|
"vitest": "4.1.6"
|
|
}
|
|
}
|