Deploy to Vercel as a TanStack Start app via Nitro

Vercel served 404s: with Hydrogen gone it treated the app as a static
Vite site, but TanStack Start's build has no index.html; pages come from
its server. Add the hosting adapter TanStack documents for Vercel:

- nitro() in vite.config, for 'vite build' only (dev and the nodesandbox
  runtime never load it); on Vercel it writes .vercel/output with the
  static assets and one Node.js function running Start + Hono
- vercel.json: tanstack-start preset, Yarn 4 via Corepack
- 'yarn start' runs the Node build; canonical URLs use the Vercel domain

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Rami Bitar
2026-10-03 15:47:53 -04:00
co-authored by Claude Opus 5.5
parent 7ec0029b08
commit 55423c7204
6 changed files with 182 additions and 7 deletions
+12 -2
View File
@@ -20,9 +20,19 @@ yarn dev # http://localhost:3000
| Script | What it does |
| ---------------- | --------------------------------------------------------- |
| `yarn dev` | Vite dev server with SSR and the Hono `/api` routes |
| `yarn build` | Production build to `dist/` |
| `yarn build` | Production build; Nitro packages the server for the host |
| `yarn start` | Run the Node build from `.output/` |
| `yarn typecheck` | `tsc` |
## Deploying to Vercel
Push and deploy — no dashboard settings. `vercel.json` selects the TanStack
Start preset and installs with Yarn 4 via Corepack. During `vite build` the
Nitro plugin detects Vercel and writes `.vercel/output/` (static assets plus one
Node.js function running TanStack Start, with Hono serving `/api/*`). Set
`VITE_SHOPIFY_*` in the project to use a real store; without them it uses
mock.shop.
## nodesandbox compatibility
The sandbox runs Vite's native tools as WebAssembly (`NAPI_RS_FORCE_WASI`), and
@@ -37,7 +47,7 @@ its installer resolves from `package.json` ranges rather than `yarn.lock`. So:
optional dependency itself, and npm on other hosts rejects them
(`EBADPLATFORM`).
- `@vitejs/plugin-react` (6.0.0) and Tailwind (4.3.1) match the harness samples.
- No Nitro.
- Nitro (the hosting adapter) only loads for `vite build`, never in `vite dev`.
## Layout