-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSR not working with some libraries #130
Comments
In general if you get an SSR issue, try adding it to the one({ deps: { '@tanstack/react-query': true } }) We are going to add an "automatic discovery" for this as one of our highest priorities as this is annoying and confusing. |
We're looking at fixing this better, because it should be automatically discovered, but because we're doing import.meta.glob inside a virtual entry, we think it's disabling the auto discovery that Vite normally does. One thing you can try is ssr.optimizeDeps.noExternal = true, its sort of brute force but can help |
@natew I think it's |
For me I also need to set import { defineConfig } from 'vite'
import { one } from 'one/vite'
export default defineConfig({
ssr: {
noExternal: true
},
plugins: [
one({
web: {
defaultRenderMode: 'ssg',
},
deps: { '@tanstack/react-query': true },
}),
],
}) |
Yes |
I get the following error in certain libraries, such as
@tanstack/react-query
. I'm assuming it has something to do with the way the bundler adds react. Perhaps react is out of scope or an issue with the way it does SSR.This error happens in ssr and ssg mode, but does not happen in spa mode. I'm wondering if the
"use client"
decorator is ignored.Here's a related issue to this.
TanStack/query#5419
The text was updated successfully, but these errors were encountered: