Skip to content

Vercel, static

hamur generate on a Vercel build (or --preset vercel-static) writes .vercel/output/ with static/ and config.json (version: 3) and no functions/. headers and noindex rules and your redirect rules are routes of config.json, because no function answers them. A route that redirects to a literal target drops the request query (/old?a=1 goes to /about); a target with ** keeps the path. A redirect target with a :param, a rewrite rule and the redirects file are not written, with a warning. Deploy it with vercel deploy --prebuilt.

Reference

Presetvercel-static
Runs onVercel, static
event.runtime.namestatic
Server targetbun
Lifetime, startupprocess, load

Output

text
.vercel/output/
  config.json                version 3; headers, noindex and redirect rules as routes
  static/                    the prerendered pages

Config keys

This preset has no key of its own.

Skew protection

With VERCEL_SKEW_PROTECTION_ENABLED=1 and VERCEL_DEPLOYMENT_ID set at build, the prerendered pages and the client pin their asset URLs and Hamur's own requests to the deployment, as on vercel.

Detection

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

Deploy command

hamur deploy builds, then runs vercel deploy --prebuilt --prod; with --preview it runs vercel deploy --prebuilt. See hamur deploy. The preview command of the preset, which hamur preview runs or prints, is vercel deploy --prebuilt.

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