-
Notifications
You must be signed in to change notification settings - Fork 14
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
ReferenceError: Element is not defined
: SSR breaks when using solid-transition-group
on cloudflare workers
#33
Comments
Here's a possible fix: import type { Component, JSX } from "solid-js";
import { isServer } from "solid-js/web";
import type { TransitionProps } from "solid-transition-group";
import { Transition as SolidTransition } from "solid-transition-group";
export const Transition: Component<
TransitionProps & {
children: JSX.Element;
}
> = (props) => {
if (isServer) {
return props.children;
}
return <SolidTransition {...props} />;
}; |
Interesting Not sure if that's an issue of |
Huh! wierd :') So that's why it was throwing an error, and why it works locally on the fix above. I tried to give it a look but found no answer to why... But it could be any one of the two, since the cloudflare adapter wraps everything on the Maybe an additional check is needed to see if it is on a Worker environemnt (a.k.a server environment)? |
Nobody's gonna do that unfortunately. Besides it would only hide the issue (like your Transition wrapper does) which is that the bundler doesn't respect export conditions in upstream dependencies. You have a client version of solid running on the server. This is something worth bringing up with the astro team instead. |
I'll open an issue there to see if we can arrange a fix. Thanks for debugging this! |
@Odas0R any updates on this? can you link the issue? |
I'm so sorry @thetarnav, it has been crazy days since the past month. I did not create the issue and forgot completely to notice you! I'll probably only be available in the summer :') If till now no one looked into this, I'll try to debug more. |
Here's the reproduction url:
https://github.com/Odas0R/solid-group-transition-bug
Everything you need to do is on the URL to throw the error. I'm using
wrangler
cli which emulates a worker environment. Code also breaks in production.This is the code that breaks:
On the astro page:
The error:
The text was updated successfully, but these errors were encountered: