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
| Preset | cloudflare-pages-static |
| Runs on | Cloudflare Pages, static |
event.runtime.name | static |
| Server target | bun |
| Lifetime, startup | process, load |
Output
.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, privateapp/env.tsentries read at run time, Durable Object classes. - It is the
staticoutput: server routes,proxy,cors,swrandcacherules andserver.fallbackProxyare 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).