Skip to content

Cloudflare Pages, static

hamur generate on a Cloudflare Pages build (or --preset cloudflare-pages-static) writes .output/public/ with the prerendered pages, _headers and _redirects, and no _worker.js or _routes.json; the build log says Pages output directory: .output/public. Deploy it with wrangler pages deploy .output/public.

Reference

Presetcloudflare-pages-static
Runs onCloudflare Pages, static
event.runtime.namestatic
Server targetbun
Lifetime, startupprocess, load

Output

text
.output/
  hamur.json
  public/                    the prerendered pages, 200.html, 404.html, _headers and _redirects

Config keys

This preset has no key of its own; the prerender keys are listed under Static.

Detection

None. hamur generate picks it when the build selects cloudflare-pages (CF_PAGES is set); --preset cloudflare-pages-static names it.

Deploy command

hamur deploy builds, then runs wrangler pages deploy .output/public; with --preview it runs wrangler pages deploy .output/public --branch preview. See hamur deploy. The preview command of the preset, which hamur preview runs or prints, is bunx wrangler pages dev .output/public.

Limits

  • Does not run: WebSockets and server.syncedState, server.pubsub, streamed answers, server.metrics, image transforms at run time, private app/env.ts entries read at run time, Durable Object classes.
  • It is the static output: server routes, proxy, cors, swr and cache rules and server.fallbackProxy are dropped with a warning.

The levels are the features of the preset: hamur build warns or fails when the app uses a feature the preset does not run (see Preset features).