Thanks for all the help! I do have a function to check if the window is present.
const isBrowser = () => typeof window !== 'undefined';
I agree it's super weird. I'm asking in some Vite/Hydrogen forums but here is the error if this means anything to you? As I mentioned before it seems related to Hydrogen, especially since it works in Next.js etc, so no worries if you're not sure, I still really appreciate your help!
10:10:54 AM [vite] Error when evaluating SSR module virtual__hydrogen-routes.server.jsx:
/home/-/Desktop/Projects/-/node_modules/gsap/ScrollTrigger.js:12
import { Observer, _getTarget, _vertical, _horizontal, _scrollers, _proxies, _getScrollFunc, _getProxyProp, _getVelocityProp } from "./Observer.js";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (<anonymous>)
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)
at Module._compile (node:internal/modules/cjs/loader:1069:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:170:29)
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
at async nodeImport (/home/-/Desktop/Projects/-/node_modules/vite/dist/node/chunks/dep-689425f3.js:50387:21)
at async eval (/src/components/IntroVideo/IntroVideo.client.jsx?no-proxy:14:31)
at async instantiateModule (/home/-/Desktop/Projects/-/node_modules/vite/dist/node/chunks/dep-689425f3.js:50317:9)
/home/-/Desktop/Projects/-/node_modules/gsap/ScrollTrigger.js:12
import { Observer, _getTarget, _vertical, _horizontal, _scrollers, _proxies, _getScrollFunc, _getProxyProp, _getVelocityProp } from "./Observer.js";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (<anonymous>)
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)
at Module._compile (node:internal/modules/cjs/loader:1069:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:170:29)
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
at async nodeImport (/home/-/Desktop/Projects/-/node_modules/vite/dist/node/chunks/dep-689425f3.js:50387:21)
at async eval (/src/components/IntroVideo/IntroVideo.client.jsx?no-proxy:14:31)
at async instantiateModule (/home/-/Desktop/Projects/-/node_modules/vite/dist/node/chunks/dep-689425f3.js:50317:9)