Module not found error: Can't resolve 'part:@sanity/desk-tool/structure
I can see you're running into a classic version mismatch issue! The error you're getting is because you're following a guide written for Sanity Studio v2, but you're likely using Sanity Studio v3 (or v4). The part: import system was completely removed in Studio v3, which is why you're getting that "Can't resolve" error.
The Solution
In Studio v3+, the import path has changed. Instead of:
// ❌ This is v2 syntax - won't work in v3+
import S from 'part:@sanity/desk-tool/structure-builder'You need to use:
// ✅ This is v3+ syntax
import {structureTool} from 'sanity/structure'How to Set Up Structure Builder in v3+
Here's the modern way to configure the Structure Builder:
1. Create a structure file (e.g., structure/index.ts or structure.ts):
import type {StructureResolver} from 'sanity/structure'
export const structure: StructureResolver = (S) =>
S.list()
.id('root')
.title('Content')
.items([
S.documentTypeListItem('post').title('Blog Posts'),
S.documentTypeListItem('author').title('Authors'),
// Add more document types as needed
])2. Import and configure it in your sanity.config.ts:
import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {structure} from './structure'
export default defineConfig({
// ...your other config
plugins: [
structureTool({structure}),
// ...other plugins
],
})What Changed Between v2 and v3?
- v2: Used the
part:system and required adeskStructure.jsfile - v3+: Uses standard ES module imports and configures everything in
sanity.config.ts - The Structure Builder object (
S) works mostly the same, but how you import and configure it is completely different
Updated Documentation
The guide you were following is outdated. For current documentation, check out:
- The Structure Builder documentation for v3+
- Studio v3 migration guide if you need to migrate existing v2 code
The good news is that once you update your imports and configuration structure, most of your actual Structure Builder code (the S.list(), S.documentTypeListItem(), etc.) will work with minimal changes!
Show original thread14 replies
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.