Summary
Building a TanStack Start app for production with any recent nitro beta produces a bundled SSR chunk that references an export (ssr_exports) which is never declared or imported in that module, causing a SyntaxError the moment the module is loaded at runtime.
Environment
nitro: reproduced on 3.0.260311-beta, 3.0.260603-beta, and 3.0.260610-beta (the three most recent date-stamped betas at time of writing)
vite: 8.2.1
@tanstack/react-start: 1.168.46
@tanstack/start-client-core: 1.170.24
- Node: 22.22.2
- Reproduced with both the default (
node-server) preset and the vercel preset — not preset-specific.
Steps to reproduce
- A standard TanStack Start app using
createServerFn (any number of server functions is enough — this is not specific to CSRF middleware; removing createCsrfMiddleware from src/start.ts does not avoid the bug).
npm run build
- Inspect
.output/server/_ssr/ssr.mjs (or the equivalent chunk under .vercel/output/functions/__server.func/_ssr/ when building with NITRO_PRESET=vercel).
Actual result
The generated chunk contains an export statement like:
export { getResponseHeaders as a, ssr_exports as c, createServerEntry, server_default as default, getCookies as i, createCsrfMiddleware as l, TSS_SERVER_FUNCTION as n, setCookie$1 as o, getServerFnById as r, setResponseHeader as s, createServerFn as t, createMiddleware as u };
Summary
Building a TanStack Start app for production with any recent
nitrobeta produces a bundled SSR chunk that references an export (ssr_exports) which is never declared or imported in that module, causing aSyntaxErrorthe moment the module is loaded at runtime.Environment
nitro: reproduced on3.0.260311-beta,3.0.260603-beta, and3.0.260610-beta(the three most recent date-stamped betas at time of writing)vite: 8.2.1@tanstack/react-start: 1.168.46@tanstack/start-client-core: 1.170.24node-server) preset and thevercelpreset — not preset-specific.Steps to reproduce
createServerFn(any number of server functions is enough — this is not specific to CSRF middleware; removingcreateCsrfMiddlewarefromsrc/start.tsdoes not avoid the bug).npm run build.output/server/_ssr/ssr.mjs(or the equivalent chunk under.vercel/output/functions/__server.func/_ssr/when building withNITRO_PRESET=vercel).Actual result
The generated chunk contains an export statement like: