Issue with workspaces in Sanity V3 upgrade
I can see exactly what's wrong with your configuration! The issue is that when you're defining multiple workspaces, you need to pass an array to defineConfig, not multiple separate arguments.
Your current code has:
export default defineConfig({
// first workspace config
},
{
// second workspace config
});But it should be:
export default defineConfig([
{
// first workspace config
},
{
// second workspace config
}
]);Notice the square brackets [...] wrapping both configuration objects? That's the key difference.
Also, when you have multiple workspaces configured this way, you need to navigate to the correct URL path. Instead of going to http://localhost:3333/desk, you need to go to:
http://localhost:3333/dev/deskfor your dev workspacehttp://localhost:3333/production/deskfor your production workspace
The basePath you've defined ('/dev' and '/production') becomes part of the URL structure. Once you wrap your configs in an array, the workspace dropdown at the top should also appear, allowing you to switch between workspaces.
Here's your corrected config:
import { defineConfig } from "sanity";
import { deskTool } from 'sanity/desk'
import schemas from './schemas/schema'
import { table } from '@sanity/table';
import { colorInput } from "@sanity/color-input";
import deskStructure from './sidebar'
import { visionTool } from '@sanity/vision'
export default defineConfig([
{
title: "XX Dev",
projectId: "XX",
dataset: "dev",
name: "dev",
basePath: '/dev',
plugins: [deskTool({structure: deskStructure}),
visionTool(),
table(),
colorInput()],
// ... rest of your dev config
},
{
title: "XX Prod",
projectId: "XX",
dataset: "production",
name: "production",
basePath: '/production',
plugins: [deskTool({structure: deskStructure}),
visionTool(),
table(),
colorInput()],
// ... rest of your production config
}
]);This is a super common mistake when migrating to V3 - you're definitely not alone! The workspaces documentation and defineConfig reference have more details on configuring multiple workspaces if you need additional reference.
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.