Production build emits invalid `ssr_exports` reference in bundled SSR chunk (TanStack Start, any preset)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 899
- Avg merge
- 2d 24m
- Merged PRs (30d)
- 40
Description
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 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.24- Node: 22.22.2
- Reproduced with both the default (
node-server) preset and thevercelpreset — 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; removingcreateCsrfMiddlewarefromsrc/start.tsdoes 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 withNITRO_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 };
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run npm run build with a standard TanStack Start app using createServerFn, then inspect .output/server/_ssr/ssr.mjs or the equivalent Vercel SSR chunk. Trace the generated export list and its source through the Nitro bundling path; done means the production SSR module loads without an undeclared ssr_exports reference for both node-server and vercel presets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- backend, build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100