import { createRouter } from '@tanstack/react-router' import { routeTree } from './routeTree.gen' // TanStack Start discovers this `getRouter` factory to build a router per // request (server) and once on the client (hydration). routeTree.gen.ts is // generated by the tanstackStart() Vite plugin from src/routes/** — don't // hand-edit it. export function getRouter() { return createRouter({ routeTree, scrollRestoration: true, defaultPreload: 'intent', }) } declare module '@tanstack/react-router' { interface Register { router: ReturnType } }