You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently trying to use stitches through Deno (1.3.3). I found out that there's an assumption in SSR that doesn't hold in the environment and subsequently running stitches through Deno crashes.
To Reproduce
Make sure to install Deno first (available through brew for example). Then, run the sample script below:
It will crash with error: Uncaught TypeError: Cannot read property 'documentElement' of undefined.
Expected behavior
It should not crash.
Proposed solution
The issue occurs because the code checks for the environment based on the existence of window. In Node environment it's undefined but in Deno it's defined as it maintains partial compatibility with the object.
To solve, there should be a more robust check against the environment that works reliably for both Node and Deno. Maybe a simple way would be to check against the Deno object as that's guaranteed to exist for Deno but it shouldn't exist in the browser.
System information
OS: macOS
Deno 1.3.3.
The text was updated successfully, but these errors were encountered:
Bug report
Stitches fails to run through Deno.
Describe the bug
I am currently trying to use stitches through Deno (1.3.3). I found out that there's an assumption in SSR that doesn't hold in the environment and subsequently running stitches through Deno crashes.
To Reproduce
Make sure to install Deno first (available through brew for example). Then, run the sample script below:
It will crash with
error: Uncaught TypeError: Cannot read property 'documentElement' of undefined
.Expected behavior
It should not crash.
Proposed solution
The issue occurs because the code checks for the environment based on the existence of
window
. In Node environment it'sundefined
but in Deno it's defined as it maintains partial compatibility with the object.To solve, there should be a more robust check against the environment that works reliably for both Node and Deno. Maybe a simple way would be to check against the
Deno
object as that's guaranteed to exist for Deno but it shouldn't exist in the browser.System information
The text was updated successfully, but these errors were encountered: