@@ -46,31 +46,35 @@ export function tanstackStart(
4646 } ,
4747 optimizeDeps :
4848 environmentName === VITE_ENVIRONMENT_NAMES . client ||
49- ( environmentName === VITE_ENVIRONMENT_NAMES . server &&
50- // This indicates that the server environment has opted in to dependency optimization
51- options . optimizeDeps ?. noDiscovery === false )
49+ ( environmentName === VITE_ENVIRONMENT_NAMES . server &&
50+ // This indicates that the server environment has opted in to dependency optimization
51+ options . optimizeDeps ?. noDiscovery === false )
5252 ? {
53- // As `@tanstack/react-start` depends on `@tanstack/react-router`, we should exclude both.
54- exclude : [
55- '@tanstack/react-start' ,
56- '@tanstack/react-router' ,
57- '@tanstack/react-router-devtools' ,
58- '@tanstack/start-static-server-functions' ,
59- ] ,
60- include : [
61- 'react' ,
62- 'react/jsx-runtime' ,
63- 'react/jsx-dev-runtime' ,
64- 'react-dom' ,
65- ...( environmentName === VITE_ENVIRONMENT_NAMES . client
66- ? [ 'react-dom/client' ]
67- : [ 'react-dom/server' ] ) ,
68- // `@tanstack/react-store` has a dependency on `use-sync-external-store`, which is CJS.
69- // It therefore needs to be included so that it is converted to ESM.
70- '@tanstack/react-router > @tanstack/react-store' ,
71- ...( options . optimizeDeps ?. exclude ?. find ( x => x === '@tanstack/react-form' ) ? [ '@tanstack/react-form > @tanstack/react-store' ] : [ ] ) ,
72- ] ,
73- }
53+ // As `@tanstack/react-start` depends on `@tanstack/react-router`, we should exclude both.
54+ exclude : [
55+ '@tanstack/react-start' ,
56+ '@tanstack/react-router' ,
57+ '@tanstack/react-router-devtools' ,
58+ '@tanstack/start-static-server-functions' ,
59+ ] ,
60+ include : [
61+ 'react' ,
62+ 'react/jsx-runtime' ,
63+ 'react/jsx-dev-runtime' ,
64+ 'react-dom' ,
65+ ...( environmentName === VITE_ENVIRONMENT_NAMES . client
66+ ? [ 'react-dom/client' ]
67+ : [ 'react-dom/server' ] ) ,
68+ // `@tanstack/react-store` has a dependency on `use-sync-external-store`, which is CJS.
69+ // It therefore needs to be included so that it is converted to ESM.
70+ '@tanstack/react-router > @tanstack/react-store' ,
71+ ...( options . optimizeDeps ?. exclude ?. find (
72+ ( x ) => x === '@tanstack/react-form' ,
73+ )
74+ ? [ '@tanstack/react-form > @tanstack/react-store' ]
75+ : [ ] ) ,
76+ ] ,
77+ }
7478 : undefined ,
7579 }
7680 } ,
0 commit comments