Deploy to Vercel
Goal: ship the app as a Vercel function with its static files on the CDN.
- Build for the
vercelpreset. It is chosen on its own whenVERCELis set, and you can name it in the config. The build writes.vercel/output/:
import { defineConfig } from "hamur"
export default defineConfig({
framework: "react",
preset: "vercel",
vercel: { functions: { maxDuration: 30 } },
})
- Set the app key in the project's environment, then deploy.
hamur deploybuilds and runsvercel deploy --prebuilt --prod;--previewmakes a draft:
vercel env add HAMUR_KEY production
hamur deploy
hamur deploy --preview
- Give the app storage that survives. A Vercel function has no disk that keeps files, so
@hamur/dband@hamur/blobfail the build until you setdb.connections.defaultandblob.driver: a hosted database through aclientfile, and thes3blob driver. The messages say which key is missing.
isr route rules become Vercel ISR functions on this preset, and vercel.functions is merged into the function's config (maxDuration, memory, regions).
See also: Vercel, hamur deploy, Caching and ISR, Database.