Function: discoverRoutes()
discoverRoutes(
appDir):string[]
Defined in: static.ts:99
Discovers the route paths served by appDir, matching the same file convention
vite.ts uses to discover hydration entry points and ReactRoute.resolveAppFile() uses to
resolve them at request time (fileToRouteTemplate() in appDirScan.ts).
app/pets.tsx and app/pets/index.tsx both legitimately serve /pets (per
ReactRoute.resolveAppFile()'s own suffix-trial order) — when both exist, they map to
the same route path here and are deduplicated. Which underlying file backs a route is
irrelevant to discovery itself: the live server (crawled over real HTTP by
exportStaticSite()) is the one that resolves the file for each request, exactly as it
would for a normal, non-exported deployment.
A dynamic route (app/pets/[id].tsx) is discovered as its :id-templated form (/pets/:id) —
see exportStaticSite() for how it is split out of the crawlable route set.
Parameters
appDir
string
Returns
string[]