T
TanStackโ€ข4y ago
like-gold

SSR build fails

May someone please lend me a hand with this? https://github.com/TanStack/query/issues/4215 ๐Ÿ™๐Ÿป
GitHub
Not able to build Vite (SSR) with react-query ยท Issue #4215 ยท TanSt...
Describe the bug This small example fails when running yarn serve (essentially yarn build && yarn serve): https://github.com/duerdod/react-query-vitejs.git. The build works fine whe...
3 Replies
ambitious-aqua
ambitious-aquaโ€ข4y ago
Issue seems to be react-query is loading the development version of react-dom
react-query doesn't decide which version (prod or dev) it loads - we just import react like everybody else ๐Ÿคทโ€โ™‚๏ธ. So it seems more like an issue for the bundler...
like-gold
like-goldOPโ€ข4y ago
Hm, yeah probably, but using @tanstack/query-core seems to work tho? But the QueryClientProvider aint available in there since it's react specific
ambitious-aqua
ambitious-aquaโ€ข4y ago
react-query has react dom as optional peerDependency because you could also use it with react native Maybe the bundler doesn't like that The query-core doesn't depend on react at all

Did you find this page helpful?