Commit Graph
5 Commits
Author SHA1 Message Date
Alaister Young b204e56fc7 feat(studio): gate TanStack Vercel config behind STUDIO_FRAMEWORK env var
vercel.ts and api/server.js are read by Vercel for every deploy in this
repo regardless of which framework preset is selected, which means the
TanStack-flavoured rewrites, `framework: null`, and `dist/server` import
would clobber the Next.js prod build. Default both to a no-op shape and
opt in to the TanStack behaviour with STUDIO_FRAMEWORK=tanstack — set in
the branch's dev/build/start/preview scripts and on the TanStack Vercel
project's dashboard env vars.
2026-05-20 10:54:33 +08:00
Alaister Young 40ef24a095 fix(studio): export TanStack handler directly using Vercel Web API convention
TanStack's server bundle already exposes `.fetch(request)`. Vercel's
Web API handler pattern (per the docs) invokes that method on the
default export, passing a real Web Request — so we can skip the
hand-rolled IncomingMessage→Request adapter entirely.
2026-04-22 02:15:30 +08:00
Alaister Young 13958a1997 fix(studio): normalize Vercel Node request shape in API wrapper
Vercel's Node runtime hands the function an IncomingMessage-shaped object:
path-only `.url`, plain-object `.headers`, Node Readable `.body`. TanStack's
H3 server wants a Web-standard Request. Convert headers to a Headers
instance, rebuild an absolute URL from the host header, and bridge the
Node stream body to a web ReadableStream via Readable.toWeb.
2026-04-22 02:13:57 +08:00
Alaister Young d5ebdebc40 fix(studio): normalize request URL before handing off to TanStack handler
Vercel's Node runtime passes a Request-like object where `.url` is
path-only (IncomingMessage semantics). TanStack's H3Event constructor
calls new URL(req.url) and crashes with ERR_INVALID_URL. Reconstruct
the URL from the host header before forwarding.
2026-04-22 02:09:51 +08:00
Alaister Young 9ee354ee65 feat(studio): serve SPA shell on unprefixed paths too
Keep the base-path-prefixed rewrites for assets and routes that Vite
already baked the prefix into, but also emit root-level rewrites so
bare-domain hits (including /) resolve to the shell instead of Vercel's
default 404.
2026-04-22 01:58:52 +08:00