Hey Cristian, it's been a while.
I've been using goober in a new library I'm trying to create that supports SSR and Hydration, and was trying to figure out why extractCss() was giving me "document is not defined" error when trying to build the html page using SSR in a Deno environment.
Turns out import { extractCss } from "https://esm.sh/goober" replaces the variable window in get-sheet.js with globalThis variable
if (typeof window === 'object') { //Node environment
if (typeof globalThis === 'object') { //Always true in a deno environment
To work around this, I had to update the import to:
import { extractCss } from "https://esm.sh/goober?target=node"
Would replacing window with document fix this to work in Node, Deno, and Browser environments for SSR and Client side updates?
if (typeof document !== "undefined")
Hey Cristian, it's been a while.
I've been using goober in a new library I'm trying to create that supports SSR and Hydration, and was trying to figure out why extractCss() was giving me "document is not defined" error when trying to build the html page using SSR in a Deno environment.
Turns out
import { extractCss } from "https://esm.sh/goober"replaces the variablewindowin get-sheet.js withglobalThisvariableTo work around this, I had to update the import to:
Would replacing window with document fix this to work in Node, Deno, and Browser environments for SSR and Client side updates?