---
url: >-
  https://lit-ui-router.dev/v1/reference/ui-router-server/prerender/interfaces/PrerenderOptions.md
---
[ui-router-server](../../index.md) / [prerender](../index.md) / PrerenderOptions

# Interface: PrerenderOptions

Defined in: prerender.ts:125

Options for [prerender](../functions/prerender.md).

## Properties

| Property | Type | Description | Defined in |
| ------ | ------ | ------ | ------ |
|  `base?` | `string` | The url path `outDir` is served at, such as Vite's `base`; `/` by default. The mounts stay at `/` and page files don't move: the base goes once onto each generated rules line's `from` and host-absolute `to`. [extraRules](#extrarules) get no base. Defaults to the [resolver](#resolver)'s own `base`; a different value throws, as does a relative or full-URL base. A [mounts](#mounts) table keyed by the base compiles as `createServerRouter({ base, mounts })` would. Either way, [paths](#paths) lie under the base, with it taken off. | prerender.ts:174 |
|  `dryRun?` | `boolean` | Plans everything and writes nothing — neither pages nor the rules file. | prerender.ts:229 |
|  `extraRules?` | [`RedirectLine`](RedirectLine.md)\[] | Lines prepended to the generated ones, percent-encoded as they are but given no base — a site's own legacy redirects. | prerender.ts:225 |
|  `mounts?` | `Record`<`string`, [`MountConfig`](../../index/interfaces/MountConfig.md)\<readonly [`RouteDeclaration`](../../redirects/interfaces/RouteDeclaration.md)\[]>> | The mount table, compiled here — or pass an already-compiled [resolver](#resolver). | prerender.ts:127 |
|  `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:203 |
|  `onPath?` | (`report`) => `void` | Called once per listed path, in enumeration order, after the path is handled: with its verdict, and the page written or redirect answered for it. Not called for the 404 document. | prerender.ts:235 |
|  `outDir` | `string` | Directory the files are written under. | prerender.ts:161 |
|  `paths` | | `Iterable`<`string`, `any`, `any`> | `AsyncIterable`<`string`, `any`, `any`> | Every path to ask for a verdict. Redirect and notFound paths belong here too. They spell the [base](#base) when [pathsIncludeBase](#pathsincludebase) is on, as it is by default for a router that declares one, and lie under it with it taken off otherwise. | prerender.ts:141 |
|  `pathsIncludeBase?` | `boolean` | Whether each of [paths](#paths) spells the [base](#base), as a host serves it: `/app/about` under `/app/`. When `true`, the base is taken off each path once, before anything else sees it, so the output matches the base-free listing; a path outside the base throws. When `false`, a path is read as given, even one that starts with the base. `pages`, `warnings` and `delegated` report each path as listed. Under base `/` it changes nothing. Defaults to whether the router declares a base: `true` for a [resolver](#resolver) from `createServerRouter({ base, mounts })` or a [mounts](#mounts) table keyed by the base, so a table that spells real urls lists real urls; `false` for a table at `/` stripped under a `base`, so its paths stay the same at any base. The default follows that declaration, never the shape of the paths. | prerender.ts:159 |
|  `render` | (`verdict`, `context`) => | `string` | [`RenderedRedirect`](RenderedRedirect.md) | `Promise`<`string` | [`RenderedRedirect`](RenderedRedirect.md)> | Renders one shell verdict to the file's full text, document included, or answers a [RenderedRedirect](RenderedRedirect.md) 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:182 |
|  `resolver?` | [`ServerRouter`](../../index/interfaces/ServerRouter.md)<[`RouteDeclaration`](../../redirects/interfaces/RouteDeclaration.md)> | A resolver from `createServerRouter`, instead of [mounts](#mounts); its mounts' trailing-slash policies come with it. Any other resolver is read as `'as-requested'`. | prerender.ts:133 |
|  `respond?` | (`verdict`, `context`) => | [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | `Promise`<[`Response`](https://developer.mozilla.org/en-US/docs/Web/API/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:194 |
|  `rules?` | [`RulesWriter`](../type-aliases/RulesWriter.md) | `"_redirects"` | `"none"` | `'_redirects'` (default) writes the Cloudflare Pages / Netlify file; `'none'` writes nothing and leaves [PrerenderResult.rules](PrerenderResult.md#rules) to the caller; a function receives the lines and writes whatever the host reads, such as `redirectPages` for a host with no redirect rules. No SPA catch-all is ever written — one turns every 404 into a 200. | prerender.ts:223 |
|  `write` | [`FileWriter`](../type-aliases/FileWriter.md) | Writes each file; pass one over `node:fs`, a virtual fs, or memory. | prerender.ts:227 |
