Issue with compiling Sanity after updating Mac OS, resolved by upgrading Studio version.
This error is related to webpack in Sanity Studio v2 having trouble transpiling modern JavaScript syntax (specifically the object spread operator ...rect) from the @floating-ui/dom package, which is a dependency of react-select, which in turn is being pulled in by the sanity-plugin-order-documents plugin.
The macOS upgrade likely updated your Node.js version or changed how npm resolves dependencies, causing newer versions of these packages to be installed that use syntax Studio v2's webpack configuration doesn't automatically transpile from node_modules.
Recommended Solutions
Option 1: Clear and reinstall dependencies
Sometimes dependency resolution issues can be fixed by clearing your cache and reinstalling:
rm -rf node_modules package-lock.json
npm installIf you're using yarn:
rm -rf node_modules yarn.lock
yarn installOption 2: Check your Node.js version
Studio v2 has specific Node.js version requirements. Check what version you're running:
node -vIf your macOS update changed your Node version, you may need to use a Node version manager (like nvm) to switch to a compatible version. Studio v2 typically works best with Node 14-16.
Option 3: Update or remove the problematic plugin
The sanity-plugin-order-documents plugin may need updating or could potentially be replaced with Studio v3's built-in ordering capabilities if you migrate. Check if there's a newer version available:
npm outdatedIf the plugin isn't critical to your workflow, you could temporarily remove it to get unblocked:
- Remove it from your
sanity.jsonplugins array - Remove it from
package.jsondependencies - Run
npm installagain
Option 4: Migrate to Studio v3 (Long-term solution)
Studio v3 uses Vite instead of webpack and handles modern JavaScript much better. While this is a bigger undertaking, it's worth considering since Studio v2 is no longer actively maintained. Studio v3 also has better built-in document ordering features that might replace your need for the plugin entirely.
Immediate Next Steps
I'd recommend trying these in order:
- Clear your dependencies and reinstall (Option 1)
- Verify your Node.js version is compatible with Studio v2 (Option 2)
- If still broken, temporarily remove the plugin to unblock development (Option 3)
- Plan a migration to Studio v3 when feasible (Option 4)
The core issue is that Studio v2's build system wasn't designed to handle the modern JavaScript syntax that newer npm packages use, which is why upgrading to Studio v3 is the most future-proof solution when your schedule allows.
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.