Which project does this relate to?
Router, react-start
Describe the bug
New version update will cause a bug that node:async_hooks.AsyncLocalStorage is bundle in client side code.
i have reproduce it in a sandbox. you could see it's happend on /posts route
this screen shot is after i add a optimizeDeps: { exclude: ['@tanstack/start-storage-context', 'node:async_hooks'], }, ssr: { noExternal: ['@tanstack/start'], external: ['node:async_hooks'], }, in vite config

Your Example Website or App
https://codesandbox.io/p/sandbox/rough-snow-tqngv6
Steps to Reproduce the Bug or Issue
- Create a middleware
import { createMiddleware } from '@tanstack/react-start'; async function serverHandler({ next, context }: any) { const result = await next(); return result; } export const getUserContextMiddleware = createMiddleware({ type: 'function', }).server(serverHandler);
- use it in a server function
export const fetchPosts = createServerFn({ method: 'GET' }).middleware([getUserContextMiddleware]).handler( async () => { console.info('Fetching posts...') return axios .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts') .then((r) => r.data.slice(0, 10)) }, )
Expected behavior
Module "node:async_hooks" has been externalized for browser compatibility. Cannot access "node:async_hooks.AsyncLocalStorage" in client code will not be occurred
Screenshots or Videos
Platform
- Router / Start Version: 1.129.0
- OS: macOs
- Browser: Chrome
- Bundler: vite
Additional context
No response
Which project does this relate to?
Router, react-start
Describe the bug
New version update will cause a bug that node:async_hooks.AsyncLocalStorage is bundle in client side code.

i have reproduce it in a sandbox. you could see it's happend on /posts route
this screen shot is after i add a
optimizeDeps: { exclude: ['@tanstack/start-storage-context', 'node:async_hooks'], }, ssr: { noExternal: ['@tanstack/start'], external: ['node:async_hooks'], },in vite configYour Example Website or App
https://codesandbox.io/p/sandbox/rough-snow-tqngv6
Steps to Reproduce the Bug or Issue
import { createMiddleware } from '@tanstack/react-start'; async function serverHandler({ next, context }: any) { const result = await next(); return result; } export const getUserContextMiddleware = createMiddleware({ type: 'function', }).server(serverHandler);export const fetchPosts = createServerFn({ method: 'GET' }).middleware([getUserContextMiddleware]).handler( async () => { console.info('Fetching posts...') return axios .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts') .then((r) => r.data.slice(0, 10)) }, )Expected behavior
Module "node:async_hooks" has been externalized for browser compatibility. Cannot access "node:async_hooks.AsyncLocalStorage" in client codewill not be occurredScreenshots or Videos
Platform
Additional context
No response