-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloudflare not loading from lib/browser.js #15
Comments
I cannot replicate this - in which mode are you? Webpack? Service worker? ES Modules? |
Apologies—should have given more details! I actually put together a test repo demonstrating the issue as I was trying to find a fix yesterday. I'm using Remix and its default CF template, which uses the service worker format. The deep import fix is demonstrated in the A bit more background: I ran into the issue while trying to set up a Sanity.io + Remix + CF Workers stack. I was able to connect to Sanity using either My test app is based on this guide on sanity.io. The example app in the guide doesn't deploy to CF, only the local app server, so the issue never came up. This could be a Remix issue—perhaps it is their bundler setup that is resolving to the wrong (non-browser) file? |
It seems like the remix compiler explicitly says to use the If I understand how the exports I'm not sure quite what the right behavior for main fields should be in terms of cloudflare workers - but I guess it kind of leans more towards a browser-like environment than it does a node environment. Knowing that, I feel like perhaps remix not respecting the Thoughts? |
You make some great points. As a node user who uses So, I think you are right—it does seem like remix not respecting |
Love picosanity! However, I've been having an issue when trying to deploy to Cloudflare Workers. For some reason, Cloudflare isn't honoring the
browser
field in picosanity'spackage.json
. It's trying to run fromlib/index.js
which won't work in CF's non-node environment. I am able to fix by deep importing:This same problem has been happening in other data source clients as well. The solution proposed in this pull request for Fauna also fixes the issue with picosanity for me and, as mentioned in the PR, may be a better solution than deep importing when using Typescript:
Bringing this to your attention as a possible fix to avoid having to do a deep import.
(This problem also exists for @sanity/client.)
The text was updated successfully, but these errors were encountered: