Static Export
Render the site to plain HTML files.
Updated: 2026-07-26
Prerendering
karui prerender renders your built site to .html files that any static host can serve, with no Node process involved. It pairs naturally with hydrateMode none for pages that ship zero JavaScript.
bash
npm run build # client + server bundles
karui prerender # -> dist/static/Dynamic routes
Static routes are discovered automatically. A dynamic route is prerendered only if its page exports staticPaths, so a missing export means "render this on demand" rather than a silently missing page.
src/pages/docs/[slug].tsx
export function staticPaths() {
return [{ slug: 'introduction' }, { slug: 'routing' }];
}Options
Point the output elsewhere, add paths the router does not know about, or render a not-found page to 404.html for host-level handling.
bash
karui prerender --out public --not-found /404 --path /extra-pageFrom a script
The same routine is available as a function. It imports Node built-ins, so it lives on its own subpath and never reaches a client bundle.
ts
import { prerenderSite } from '@rigbyhost/karui/ssr/prerender';
const pages = await prerenderSite({
outDir: 'dist/static',
notFoundPath: '/404',
});
console.log(`${pages.length} pages written`);