@@ -32,8 +32,14 @@ export function tanstackStart(
3232 name : 'tanstack-react-start:config' ,
3333 configEnvironment ( environmentName , options ) {
3434 if ( environmentName === VITE_ENVIRONMENT_NAMES . client ) {
35- if ( options . optimizeDeps ?. exclude ?. find ( x => x === '@tanstack/react-form' ) ) {
36- options . optimizeDeps ?. include ?. push ( '@tanstack/react-form > @tanstack/react-store' )
35+ if (
36+ options . optimizeDeps ?. exclude ?. find (
37+ ( x ) => x === '@tanstack/react-form' ,
38+ )
39+ ) {
40+ options . optimizeDeps ?. include ?. push (
41+ '@tanstack/react-form > @tanstack/react-store' ,
42+ )
3743 }
3844 }
3945 return {
@@ -51,31 +57,35 @@ export function tanstackStart(
5157 } ,
5258 optimizeDeps :
5359 environmentName === VITE_ENVIRONMENT_NAMES . client ||
54- ( environmentName === VITE_ENVIRONMENT_NAMES . server &&
55- // This indicates that the server environment has opted in to dependency optimization
56- options . optimizeDeps ?. noDiscovery === false )
60+ ( environmentName === VITE_ENVIRONMENT_NAMES . server &&
61+ // This indicates that the server environment has opted in to dependency optimization
62+ options . optimizeDeps ?. noDiscovery === false )
5763 ? {
58- // As `@tanstack/react-start` depends on `@tanstack/react-router`, we should exclude both.
59- exclude : [
60- '@tanstack/react-start' ,
61- '@tanstack/react-router' ,
62- '@tanstack/react-router-devtools' ,
63- '@tanstack/start-static-server-functions' ,
64- ] ,
65- include : [
66- 'react' ,
67- 'react/jsx-runtime' ,
68- 'react/jsx-dev-runtime' ,
69- 'react-dom' ,
70- ...( environmentName === VITE_ENVIRONMENT_NAMES . client
71- ? [ 'react-dom/client' ]
72- : [ 'react-dom/server' ] ) ,
73- // `@tanstack/react-store` has a dependency on `use-sync-external-store`, which is CJS.
74- // It therefore needs to be included so that it is converted to ESM.
75- '@tanstack/react-router > @tanstack/react-store' ,
76- ...( options . optimizeDeps ?. exclude ?. find ( x => x === '@tanstack/react-form' ) ? [ '@tanstack/react-form > @tanstack/react-store' ] : [ ] ) ,
77- ] ,
78- }
64+ // As `@tanstack/react-start` depends on `@tanstack/react-router`, we should exclude both.
65+ exclude : [
66+ '@tanstack/react-start' ,
67+ '@tanstack/react-router' ,
68+ '@tanstack/react-router-devtools' ,
69+ '@tanstack/start-static-server-functions' ,
70+ ] ,
71+ include : [
72+ 'react' ,
73+ 'react/jsx-runtime' ,
74+ 'react/jsx-dev-runtime' ,
75+ 'react-dom' ,
76+ ...( environmentName === VITE_ENVIRONMENT_NAMES . client
77+ ? [ 'react-dom/client' ]
78+ : [ 'react-dom/server' ] ) ,
79+ // `@tanstack/react-store` has a dependency on `use-sync-external-store`, which is CJS.
80+ // It therefore needs to be included so that it is converted to ESM.
81+ '@tanstack/react-router > @tanstack/react-store' ,
82+ ...( options . optimizeDeps ?. exclude ?. find (
83+ ( x ) => x === '@tanstack/react-form' ,
84+ )
85+ ? [ '@tanstack/react-form > @tanstack/react-store' ]
86+ : [ ] ) ,
87+ ] ,
88+ }
7989 : undefined ,
8090 }
8191 } ,
0 commit comments