Skip to content

Netlify, static

hamur generate on a Netlify build (or --preset netlify-static) writes dist/, the folder Netlify publishes, with the prerendered pages, _headers and _redirects, and no function; the build log says Publish directory: dist. Deploy it with netlify deploy --dir dist --prod.

Reference

Presetnetlify-static
Runs onNetlify, static
event.runtime.namestatic
Server targetbun
Lifetime, startupprocess, load

Output

text
dist/
  _headers, _redirects
  ...                        the prerendered pages

Config keys

This preset has no key of its own.

Detection

None. hamur generate picks it when the build selects netlify (NETLIFY is set); --preset netlify-static names it.

Deploy command

hamur deploy builds, then runs netlify deploy --no-build --dir dist --prod; with --preview it runs netlify deploy --no-build --dir dist. See hamur deploy. The preview command of the preset, which hamur preview runs or prints, is netlify dev --dir dist.

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).