Working with a Version 3 Sanity project to provide backend data.
However, I noticed that there are two files that deals with project settings/configurations.
PROJECT_DIR/sanity.config.js
- included from startupPROJECT_DIR/sanity.json
- not included from startupMy question are
plugins
that are already defined in sanity.config.js
, do I define them again in sanity.json
?Please help, as I cannot find any documentation that addresses my questions above,
An example taken from sanity docs sanity.json
{
"root": true,
"project": {
"name": "Movies",
"basePath": "/studio"
},
"api": {
"projectId": "<yourProjectID>",
"dataset": "production"
},
"plugins": [
"@sanity/base",
"@sanity/components",
"@sanity/default-layout",
"@sanity/default-login",
"@sanity/desk-tool",
"@sanity/google-maps-input"
],
"parts": [
{
"name": "part:@sanity/base/schema",
"path": "./schemas/schema.js"
}
]
}
And an example from my project sanity.config.js
import {defineConfig} from 'sanity'
import {deskTool} from 'sanity/desk'
import {visionTool} from '@sanity/vision'
import {schemaTypes} from './schemas'
export default defineConfig({
name: 'default',
title: 'app-title',
projectId: '<project-id>',
dataset: 'production',
plugins: [deskTool(), visionTool()],
schema: {
types: schemaTypes,
},
})
Would I still include "@sanity/desk-tool"
in my sanity.json
if deskTool() is already added within the plugins array in sanity.config.js
The JSON-based configuration in sanity.json
file has been deprecated on Sanity v3 in favor of sanity.config.js
file, this is one of their breaking changes. See docs for reference. In other words, if you're using Sanity v3, don't include sanity.json
, handle all the configs that were previously in that file on sanity.config.js
.