Options for the React Router plugin.
serverBuildPath: string
Path to the React Router Vite server build (default export = ServerBuild).
Must be absolute — an absolute filesystem path or a file: URL. The
default loader performs await import(serverBuildPath), and a relative
specifier there resolves against this plugin's own module rather than
against the consuming application, so it can never find the build. From an
application module, derive one with
new URL('./build/server/index.js', import.meta.url).href.
loadRequestHandler: (serverBuildPath: string,mode: string) => Promise<SsrRuntime>
Injectable seam for lazy loading the RR runtime. When omitted, the default
performs await import(serverBuildPath) + await import('npm:react-router@8').
Also the supported hook for a development server: return a handler built
over a build thunk (createRequestHandler(() => vite.ssrLoadModule(...)))
to pick up rebuilds without restarting the process.
assetsDir: string
Filesystem root of the built client bundle. Omit to disable static-asset serving (no asset route registered).
assetUrlPrefix: string
URL prefix for the static-asset route. Default /assets/.
publicFiles: boolean
Also serves files from the client-build ROOT — where Vite copies public/
(robots.txt, favicon.ico, …) — in addition to
ReactRouterPluginOptions.assetUrlPrefix, with
Cache-Control: public, max-age=0, must-revalidate: root files are not
content-hashed, so they must be revalidated rather than cached immutably.
A request matching neither the root nor the prefix still falls through to
the SSR catch-all.
Default true. false preserves prefix-only serving exactly as before.
basename: string
Mount prefix for the SSR catch-all route. Default /.
MUST match the app's react-router.config.ts basename for flat/nested
routes to resolve.
populateLoadContext: PopulateLoadContext
Adds application values to the per-request React Router context, on top of
the servicesContext and userContext keys the plugin
always sets.
Replaces the removed getLoadContext option: React Router 8 requires a
real RouterContextProvider instance, which an app-supplied function
cannot safely construct, so the callback now mutates the provider the
plugin built instead of returning a plain object.
mode: "production" | "development"
Mode passed to createRequestHandler(build, mode).