Test app demonstrating issue with Sanity.io + Remix on Cloudflare Workers
This directory contains a Remix app with a deploy target of Remix App Server
that successfully connects to Sanity.io via @sanity/client
and reads data via Remix loaders.
/remix-app-server-picosanity
is the same app, but with picosanity swapped in for @sanity/client
.
This directory contains a Remix app with a deploy target of Cloudflare Workers
with the exact same /app
directory from ../remix-app-server
. However, miniflare errors when running npm run dev
, giving TypeError: globalThis.XMLHttpRequest is not a constructor
.
/cf-workers-picosanity
is the same app, but with picosanity swapped in for @sanity/client
.
It appears the root cause for this issue is that, for some reason, Cloudflare isn't honoring the browser
field in package.json
within picosanity and @sanity/client. I'm able to fix this issue with picosanity by deep importing directly from picosanity/lib/browser
in this file.
If anyone knows of a possible fix, please let me know!
These demos are based on @SimeonGriggs's Sanity.io + Remix with Live Preview.