Impossible to run sanity-plugin-r2-files using Bun
I was waiting for this plugin a long time! Thank you so much for the hard work 🙏
Finally tried to use it on my Sanity setup using Bun (v1.1.33) but I get this error when launching the Studio (followed by this console error "Failed to load resource: the server responded with a status of 504 (Outdated Optimize Dep)"):
$ sanity dev
✅ Checking configuration files...
Sanity Studio using [email protected] ready in 1058ms and running at http://localhost:3333/
✘ [ERROR] No matching export in "node_modules/xstate/dist/xstate.development.esm.js" for import "InterpreterStatus"
node_modules/@xstate/react/es/useInterpret.js:41:20:
41 │ import { interpret, InterpreterStatus, State, toObserver } from 'xstate';
╵ ~~~~~~~~~~~~~~~~~
✘ [ERROR] No matching export in "node_modules/xstate/dist/xstate.development.esm.js" for import "State"
node_modules/@xstate/react/es/useInterpret.js:41:39:
41 │ import { interpret, InterpreterStatus, State, toObserver } from 'xstate';
╵ ~~~~~
✘ [ERROR] No matching export in "node_modules/xstate/dist/xstate.development.esm.js" for import "InterpreterStatus"
node_modules/@xstate/react/es/utils.js:28:9:
28 │ import { InterpreterStatus } from 'xstate';
╵ ~~~~~~~~~~~~~~~~~
✘ [ERROR] No matching export in "node_modules/xstate/dist/xstate.development.esm.js" for import "InterpreterStatus"
node_modules/@xstate/react/es/useMachine.js:19:9:
19 │ import { InterpreterStatus, State } from 'xstate';
╵ ~~~~~~~~~~~~~~~~~
✘ [ERROR] No matching export in "node_modules/xstate/dist/xstate.development.esm.js" for import "State"
node_modules/@xstate/react/es/useMachine.js:19:28:
19 │ import { InterpreterStatus, State } from 'xstate';
╵ ~~~~~
✘ [ERROR] No matching export in "node_modules/xstate/dist/xstate.development.esm.js" for import "spawnBehavior"
node_modules/@xstate/react/es/useSpawn.js:1:9:
1 │ import { spawnBehavior } from 'xstate';
╵ ~~~~~~~~~~~~~
Having tried with a monorepo setup and a simple sanity init project, I feel that the plugin is not totally optimized to be used with Bun. Only works when I tried installing it with npm on the clean Sanity install. The thing is that my usual setup is using Bun workspaces so I cannot both use bun and npm.
Not sure what needs to be fixed but here are my 2 cents 🙈
Tagging @emilianscheel for visibility
Self-diagnose (with a little help from Claude):
Installing these to my Sanity package.json helps and I can run the Studio using Bun. Something to do with xstate versions?
bun add xstate@latest @xstate/react@latest