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

# Interface: PrerenderOptions

Defined in: [packages/lit-ui-router-ssr/src/prerender.ts:113](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router-ssr/src/prerender.ts#L113)

Options for [prerender](../functions/prerender.md): those of `ui-router-server/prerender`'s loop, with
a lit render in place of its `render`.

## Extends

* `Omit`<`SitePrerenderOptions`, `"render"` | `"respond"` | `"write"`>

## Properties

| Property | Type | Description | Inherited from | 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) are written as given. 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. | `Omit.base` | packages/ui-router-server/dist/prerender.d.ts:115 |
|  `dehydrate?` | `DehydrateOptions` | Draws each rendered page's resolve payload with `dehydrate` from `ui-router-server/ssr`, called with these options on the transition the router last landed, once `renderShell` has returned a template. The payload's `resolves` go into the page's hydration signature, beside the state and parameters the router stands on, and the client adopts them on boot in place of running those resolve functions. Pass `{}` to draw every resolve `dehydrate` draws by default. Without this option or [\`payload\`](#payload), no page carries resolves. `dehydrate`'s documentation says which values it leaves out and how `shouldDehydrate` and `transport` act. The payload's `transported` marks go into the signature too, so a value a transporter carried is rebuilt when `bootstrap()` gets the same `transport`. **Example** `nocheck dehydrate: { shouldDehydrate: ({ token }) => token !== 'manifest', transport, },` | - | [packages/lit-ui-router-ssr/src/prerender.ts:208](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router-ssr/src/prerender.ts#L208) |
|  `document?` | (`body`, `context`) => `string` | `Promise`<`string`> | Wraps a rendered body in the page document — the shell html, its `<title>`, its head. Defaults to the body unchanged. This package never parses or rewrites html. | - | [packages/lit-ui-router-ssr/src/prerender.ts:142](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router-ssr/src/prerender.ts#L142) |
|  `dryRun?` | `boolean` | Plans everything and writes nothing — neither pages nor the rules file. | `Omit.dryRun` | packages/ui-router-server/dist/prerender.d.ts:164 |
|  `elementRenderers?` | `ElementRendererConstructor`\[] | Element renderers passed through to `@lit-labs/ssr`, verbatim. Defaults to `[UiViewRenderer, LightElementRenderer]` — not `@lit-labs/ssr`'s `[LitElementRenderer]`, which wraps every custom element in a declarative shadow root it never asked for. `LightElementRenderer` answers only for a class `LightDomHydrating` branded. A list passed here replaces the default, so keep `LightElementRenderer` in it, ahead of any renderer that writes a shadow root, to draw those elements. Pass `[]` for a render with no `<ui-view>` to fill. A shadow-DOM `LitElement` no renderer in the list answers for renders as its bare tag, empty, and warns once per tag in development; put `LitElementRenderer` after `LightElementRenderer` to draw it. | - | [packages/lit-ui-router-ssr/src/prerender.ts:163](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router-ssr/src/prerender.ts#L163) |
|  `extraRules?` | [`RedirectLine`](RedirectLine.md)\[] | Lines prepended to the generated ones, verbatim — a site's own legacy redirects. | `Omit.extraRules` | packages/ui-router-server/dist/prerender.d.ts:160 |
|  `mounts?` | `Record`<`string`, [`MountConfig`](/reference/ui-router-server/index/interfaces/MountConfig)\<readonly `RouteDeclaration`\[]>> | The mount table, compiled here — or pass an already-compiled [resolver](#resolver). | `Omit.mounts` | packages/ui-router-server/dist/prerender.d.ts:68 |
|  `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. | `Omit.notFound` | packages/ui-router-server/dist/prerender.d.ts:140 |
|  `origin?` | `string` | The origin of the request a response handler gets, such as `https://example.com`. Defaults to `http://lit-ui-router-ssr`, a host that names this package so a url built from it stands out in the output. A handler that answers with paths needs none; pass the site's own origin when a handler builds absolute urls from `request.url`. | - | [packages/lit-ui-router-ssr/src/prerender.ts:182](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router-ssr/src/prerender.ts#L182) |
|  `outDir` | `string` | Directory the files are written under. | `Omit.outDir` | packages/ui-router-server/dist/prerender.d.ts:102 |
|  `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. | `Omit.paths` | packages/ui-router-server/dist/prerender.d.ts:82 |
|  `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. | `Omit.pathsIncludeBase` | packages/ui-router-server/dist/prerender.d.ts:100 |
|  `payload?` | (`transition`, `context`) => [`ResolvePayload`](ResolvePayload.md) | `undefined` | Draws the resolve payload for a rendered page by hand, in place of [\`dehydrate\`](#dehydrate): handed the transition the router last landed, once `renderShell` has returned a template, it returns the payload the page's signature carries, or `undefined` to write none. Passing both this and `dehydrate` throws. **Example** Shape the payload `dehydrate` draws before it is written: `nocheck import { dehydrate } from 'ui-router-server/ssr'; payload: (transition, { path }) => path.startsWith('/drafts/') ? undefined : dehydrate(transition, { transport }).payload,` | - | [packages/lit-ui-router-ssr/src/prerender.ts:227](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router-ssr/src/prerender.ts#L227) |
|  `renderShell` | (`verdict`, `context`) => `string` | `TemplateResult` | `Promise`<`string` | `TemplateResult`> | Renders one shell verdict. Return a template and this package renders it, behind the hydration signature; return a string and it is written as-is. Async, so a hook may drive [router](#router) to the path before it returns. When the transition the router lands on during the hook was redirected, by a `redirectTo` function for one, the path gets a rules line to where it landed, at the redirecting state's `redirectStatusCode`, and no page: `redirectedTo` from `ui-router-server/ssr` reports it. | - | [packages/lit-ui-router-ssr/src/prerender.ts:133](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router-ssr/src/prerender.ts#L133) |
|  `resolver?` | [`ServerRouter`](/reference/ui-router-server/index/interfaces/ServerRouter)<`RouteDeclaration`> | A resolver from `createServerRouter`, instead of [mounts](#mounts); its mounts' trailing-slash policies come with it. Any other resolver is read as `'as-requested'`. | `Omit.resolver` | packages/ui-router-server/dist/prerender.d.ts:74 |
|  `responses?` | `Readonly`<`Record`<`string`, [`ResponseHandler`](../type-aliases/ResponseHandler.md)<`never`>>> | Handlers for the router's response states, keyed by state name, as [responder](../functions/responder.md) takes them. A path that matches one settles [router](#router) on it and writes what its handler answers: a 2xx body at the path its url spells, or a 3xx as a rules line. The handler's request is a GET for the path under [base](#base) at [origin](#origin). Without this option, a response state throws. | - | [packages/lit-ui-router-ssr/src/prerender.ts:174](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router-ssr/src/prerender.ts#L174) |
|  `root?` | `EventTarget` | The render's root event target. A bare `new EventTarget()` is created when none is passed; either way [router](#router) is provided on it, it reaches every render on `eventTargetStack`, and it is returned on the result so the caller can attach providers of its own before the call. | - | [packages/lit-ui-router-ssr/src/prerender.ts:150](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router-ssr/src/prerender.ts#L150) |
|  `router` | [`UIRouterLit`](/reference/lit-ui-router/core/UIRouterLit) | The router the render reads: provided on [root](#root) for `context-request` and scoped with `withRouterSync` around every render, so `<ui-router>` descendants and the sref attribute directives both find it. | - | [packages/lit-ui-router-ssr/src/prerender.ts:122](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router-ssr/src/prerender.ts#L122) |
|  `rules?` | `"none"` | `"_redirects"` | `RulesWriter` | `'_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. | `Omit.rules` | packages/ui-router-server/dist/prerender.d.ts:158 |
|  `write?` | [`FileWriter`](../type-aliases/FileWriter.md) | Writes a file. Defaults to `node:fs`, imported lazily on first write. | - | [packages/lit-ui-router-ssr/src/prerender.ts:184](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router-ssr/src/prerender.ts#L184) |
