# Component Dependencies: prerendering ```mermaid graph TD Vite["vite.config.ts"] Router["src/router.tsx"] Root["routes/__root.tsx"] Client["src/client.tsx"] Routes["Page routes and catch-all route"] Hydrated["useHydrated and server-safe hooks"] Display["Reveal, DeferredImage, NoScriptNav"] Extract["config/externalizeInlineScripts.ts"] Logic["config/inlineScripts.ts"] Output["dist/client"] Preview["config/previewServer.ts"] Headers["config/securityHeaders.ts"] ServerConfig["config/serverConfig.ts"] E2E["e2e browser tests and Lighthouse"] Vite --> Router Router --> Root Client --> Router Root --> Routes Routes --> Hydrated Routes --> Display Display --> Hydrated Vite --> Output Extract --> Logic Extract --> Output Preview --> Output Preview --> Headers ServerConfig --> Headers E2E --> Preview classDef build fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000; classDef app fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000; classDef infra fill:#fbd38d,stroke:#92400e,stroke-width:1px,color:#000; classDef check fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000; class Vite,Extract,Logic,Output build; class Router,Root,Client,Routes,Hydrated,Display app; class Preview,Headers,ServerConfig infra; class E2E check; ``` Text alternative: the Vite config drives the router, root route and pages, which use hydration-safe hooks and display components; the post-build step rewrites the client output; the preview server serves that output with the shared headers for the browser tests and Lighthouse. ## Dependency matrix | Component | Depends on | Used by | Communication | |---|---|---|---| | `tanstackStart` plugin | `src/router.tsx`, route tree | Build | Build time | | `__root.tsx` shell | `HeadContent`, `Scripts`, `ChakraProvider`, `theme.ts` | All pages | Render | | `useHydrated` | React | `NotFound`, search-dependent routes, display components | Hook | | `inlineScripts.ts` | None | Runner, tests | Pure function | | `externalizeInlineScripts.ts` | `inlineScripts.ts`, file system | `pnpm build` | Build time | | `previewServer.ts` | `securityHeaders.ts`, file system | Lighthouse, `e2e/` | HTTP | | `serverConfig.ts` | `securityHeaders.ts` | `deploy/` | Generated files | ## Unit boundaries | Unit | Owns | |---|---| | 1 | Build and entry, hydration safety, script step, preview server, browser tests, test setup, CI output path | | 2 | `Reveal`, `DeferredImage`, `NoScriptNav`, no-JavaScript fallbacks, photo preload | | 3 | `serverConfig.ts`, `deploy/`, CI upload order, Lighthouse targets | Units run in sequence, so shared files are not a merge concern.