"window is not defined" Error When Deploying Remix Project to Cloudflare Workers

What I'm trying to deploy my Remix project to Cloudflare Workers, but I'm encountering the following error:
Failed to publish your Function. Got error: Uncaught ReferenceError: window is not defined
at functionsWorker-0.38350223454284715.js:28168:5 in
../node_modules/.pnpm/[email protected][email protected]/node_modules/styletron-react/dist-browser-cjs/index.js
Failed to publish your Function. Got error: Uncaught ReferenceError: window is not defined
at functionsWorker-0.38350223454284715.js:28168:5 in
../node_modules/.pnpm/[email protected][email protected]/node_modules/styletron-react/dist-browser-cjs/index.js
Expectation The goal is to deploy the project successfully to Cloudflare Workers without any issues. Environment Remix: v2.15.2 styletron-react: v6.1.1 Cloudflare Workers Vite: v6.0.7 TypeScript: v5.7.2 Code https://github.com/eiei114/im-ts-frontend-template
GitHub
GitHub - eiei114/im-ts-frontend-template
Contribute to eiei114/im-ts-frontend-template development by creating an account on GitHub.
2 Replies
eisuke
eisukeOP3w ago
GitHub
examples/styletron at main · remix-run/examples
A community-driven repository showcasing examples using Remix 💿 - remix-run/examples
eisuke
eisukeOP3w ago
Created a simple remix repository to deploy to cloudflare https://github.com/eiei114/remix-cloudflare-styletron-test
GitHub
GitHub - eiei114/remix-cloudflare-styletron-test
Contribute to eiei114/remix-cloudflare-styletron-test development by creating an account on GitHub.

Did you find this page helpful?