Which project does this relate to?
Router
Describe the bug
Repro: https://github.com/arackaf/tanstack-blog-blog-post
npm run build
npm start
root page should render. Click on a blog post - page will error.
This fetch
http://localhost:3000/__tsr/staticServerFnCache/e43004e6c38437f0d2f24def37e3af0e555c9e94.json
404's. Here's AI's take:
You've found a real build-order bug, not a missing dependency. The cache files exist on disk; the Nitro production server just doesn't know about them.
Root cause: build order
The __tsr/staticServerFnCache/*.json files are created after Nitro bakes the static asset manifest into the server bundle.
Flow:
Nitro builds .output/server/index.mjs and scans .output/public/ into a hardcoded assets map.
TanStack prerender runs later (via staticFunctionMiddleware during prerender) and writes cache files to .output/public/__tsr/staticServerFnCache/.
The cache files are written 3 seconds after the server bundle is finalized.
Both plugins use buildApp: { order: "post" }, but Nitro's hook runs before TanStack's post-build prerender. So the manifest is frozen before __tsr exists.
Complete minimal reproducer
https://github.com/arackaf/tanstack-blog-blog-post
Steps to Reproduce the Bug
See above
Expected behavior
Should work :)
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.168.6
- OS: macOS
- Browser: Chrome
- Browser Version: 148
- Bundler: Vite
- Bundler Version: 7.1.7
Additional context
No response
Which project does this relate to?
Router
Describe the bug
Repro: https://github.com/arackaf/tanstack-blog-blog-post
npm run build
npm start
root page should render. Click on a blog post - page will error.
This fetch
http://localhost:3000/__tsr/staticServerFnCache/e43004e6c38437f0d2f24def37e3af0e555c9e94.json
404's. Here's AI's take:
You've found a real build-order bug, not a missing dependency. The cache files exist on disk; the Nitro production server just doesn't know about them.
Root cause: build order
The __tsr/staticServerFnCache/*.json files are created after Nitro bakes the static asset manifest into the server bundle.
Flow:
Nitro builds .output/server/index.mjs and scans .output/public/ into a hardcoded assets map.
TanStack prerender runs later (via staticFunctionMiddleware during prerender) and writes cache files to .output/public/__tsr/staticServerFnCache/.
The cache files are written 3 seconds after the server bundle is finalized.
Both plugins use buildApp: { order: "post" }, but Nitro's hook runs before TanStack's post-build prerender. So the manifest is frozen before __tsr exists.
Complete minimal reproducer
https://github.com/arackaf/tanstack-blog-blog-post
Steps to Reproduce the Bug
See above
Expected behavior
Should work :)
Screenshots or Videos
No response
Platform
Additional context
No response