-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
@astro/solid-js does not work with @astro/cloudflare adapter #4766
Comments
Have you reached out to the SolidJS people about this? I'm betting they'd like to make it work in Cloudflare. |
Did a little research and the reason is because of this line:
I think this is configuring Vite to prefer web entrypoints which results in the non-SSR code being bundled for Solid. @nrgnrg wrote the Cloudflare adapter, do you know why you used this setting? |
I think the So there are 2 questions than:
@ryansolid, @nksaraf can you maybe give us a pointer, on how solid is meant to work in an webworker environment in regards to SSR / SSG. I have seen the SolidJS Guide mentioning streaming to work in a Cloudflare worker, but did not manage to get it to work. Is there some sort of example repo? |
We can add an export condition to support this. We just need to figure out which. Is it the "worker" condition? Generally speaking we have nothing Node specific so we've been just using "node" condition and it's been fine. But there are reasons not the set the "node" condition for workers. |
Some more digging revealed to me that the target
and that works for react and solid-js, I am not sure about svelte and vue though. Can somebody help test those out? @ryansolid I guess there is no need for a condition since it works perfectly with the |
I think the Platform browser could be really awkward if it overrides things. We have browser field too so that people can have an environment work in browser mode, but browser mode is way different than server rendering in a worker. |
Spot on, just had my issues finding how to configure and fallback. Found the correct settings though, to support |
What version of
astro
are you using?1.2.4
Are you using an SSR adapter? If so, which one?
Cloudflare
What package manager are you using?
npm
What operating system are you using?
Windows
Describe the Bug
SSR is enforced due to Cloudflare adapter. But SSR is not working with Solid in the Cloudflare environment (Worker).
Error: Ct is not supported in the browser, returning undefined
Here
Ct
is the minified name of{ renderToString } from "solid-js/web"
. So Astro seems to call the server function for SSR but Solid recognizes the environment of a browser and does not seem to support it.There are some potential solutions to work around this:
client:only
to all components and loose pre-render completelyWhat astrojs could do:
Link to Minimal Reproducible Example
https://github.com/AirBorne04/minimal-astro-cloudflare-solid
Participation
The text was updated successfully, but these errors were encountered: