Skip to content

ui-router-server / prerender / PrerenderOptions

Interface: PrerenderOptions ​

Defined in: prerender.ts:69

Options for prerender.

Properties ​

PropertyTypeDescriptionDefined in
dryRun?booleanPlans everything and writes nothing — neither pages nor the rules file.prerender.ts:144
extraRules?RedirectLine[]Lines prepended to the generated ones, verbatim — a site's own legacy redirects.prerender.ts:130
mounts?Record<string, MountConfig<readonly RouteDeclaration[]>>The mount table, compiled here — or pass an already-compiled resolver.prerender.ts:71
notFound?| false | { file?: string; probe?: string; }The 404 document, emitted once from the otherwise projection. false emits none, and nothing is emitted when the probed mount declares no projection.prerender.ts:106
outDirstringDirectory the files are written under.prerender.ts:77
paths| Iterable<string, any, any> | AsyncIterable<string, any, any>Every path to ask for a verdict. Redirect and notFound paths belong here too.prerender.ts:75
render(verdict, context) => | string | RenderedRedirect | Promise<string | RenderedRedirect>Renders one shell verdict to the file's full text, document included, or answers a RenderedRedirect for a page whose render found it redirects, such as a redirectTo function settle followed: the path gets a rules line and no page. Renders run one at a time, in enumeration order, then the 404 document, which must render a page.prerender.ts:85
resolver?ServerRouter<RouteDeclaration>A resolver from createServerRouter, instead of mounts.prerender.ts:73
respond?(verdict, context) => | Response | Promise<Response>Answers one response verdict: settle the state and run the handler bound to its name. A 2xx answer's body, read as text, is written to the path its url spells (badge.svg; index.html at the mount root), its headers dropped; a 3xx becomes a rules line to its Location; any other status throws. Runs in the same sequence as render. lit-ui-router-ssr's prerender supplies it from the handlers bound by state name.prerender.ts:97
rules?"_redirects" | "none" | ((lines) => void | Promise<void>)'_redirects' (default) writes the Cloudflare Pages / Netlify file; 'none' writes nothing and leaves PrerenderResult.rules to the caller; a function receives the lines and writes whatever the host reads. No SPA catch-all is ever written — one turns every 404 into a 200.prerender.ts:125
trailingSlash?"both" | "exact"'both' (default) emits every generated redirect line twice, with and without the trailing slash: a static host that appends one would otherwise miss the rule. Shell verdicts need no rules line — they are written as <subpath>/index.html, which both spellings reach — but a host that reaches it by redirecting <subpath> to <subpath>/ boots the client at the slashed url, so the client's strictMode(false) and the mount's config: { strict: false } must both admit it.prerender.ts:140
writeFileWriterWrites each file; pass one over node:fs, a virtual fs, or memory.prerender.ts:142