[]previous and next page

prerenderFile

The file a path is written to, inside clientDir: / is index.html, /about is about/index.html.

The file a path is written to, inside clientDir: / is index.html, /about is about/index.html. Percent escapes are decoded once; a segment that could leave the folder or is too long is refused.

Import#

ts
import { prerenderFile } from "@shadow-js/dusk/vite";

Signature#

ts
function prerenderFile(clientDir: string, path: string): string

Parameters#

Name Description
clientDir The output folder.
path A URL path starting with /.

Returns#

The absolute file path.

Throws#

  • PrerenderError for a path that is not safe to write.

Examples#

ts
prerenderFile("/app/dist/client", "/about"); // "/app/dist/client/about/index.html"