You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, thansk for this plugin.
I unfortunately encounter an error while including this in the plugins array in sanity.config.ts.
Error
Error: require()ofESModule/var/www/node_modules/@superside-oss/sanity-plugin-copy-paste/node_modules/nanoid/index.jsfrom/var/www/node_modules/@superside-oss/sanity-plugin-copy-paste/dist/index.jsnotsupported.Insteadchangetherequireof/var/www/node_modules/@superside-oss/sanity-plugin-copy-paste/node_modules/nanoid/index.jsin/var/www/node_modules/@superside-oss/sanity-plugin-copy-paste/dist/index.jstoadynamicimport()which is availableinallCommonJSmodules.
import{table}from"@sanity/table";import{visionTool}from"@sanity/vision";import{copyPastePlugin}from"@superside-oss/sanity-plugin-copy-paste";import{defineConfig}from"sanity";import{structureTool}from"sanity/structure";import{iconPicker}from"sanity-plugin-icon-picker";import{media}from"sanity-plugin-media";importsingletonsfrom"./sanitySchemas/models/singleton";import{customStructure,SingletonType,}from"./src/components/sanity/deskTool/customStructure";importStudioLogofrom"./src/lib/sanity/sanityStudioTheme/components/StudioLogo/StudioLogo";importStudioNavBarfrom"./src/lib/sanity/sanityStudioTheme/components/StudioNavBar/StudioNavBar";import{toSpitiMasTheme}from"./src/lib/sanity/sanityStudioTheme/sanityTheme";import{schemaTypes}from"./sanitySchemas";// Define the actions that should be available for singleton documentsconstsingletonActions=newSet(["publish","discardChanges","restore"]);// dynamically import all singleton pagesconstsingletonPages=singletons.map((model)=>model.name)asstring[];exportdefaultdefineConfig({name: process.env.NEXT_PUBLIC_SANITY_DATASET,title: process.env.NEXT_PUBLIC_SANITY_DATASET,projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID,dataset: process.env.NEXT_PUBLIC_SANITY_DATASET,basePath: "/studio",plugins: [iconPicker(),structureTool({// Custom structure to allow singleton pages to be visible in the studiostructure: (S)=>customStructure(S,singletonsasSingletonType[]),}),visionTool(),table(),media(),copyPastePlugin(),],schema: {types: schemaTypes,// Filter out singleton types from the global “New document” menu optionstemplates: (templates)=>templates.filter((template)=>!singletonPages.includes(template.id)),},document: {// For singleton types, filter out actions that are not explicitly included// in the `singletonActions` list defined aboveactions: (input,context)=>singletonPages.includes(context.schemaType)
? input.filter(({ action })=>action&&singletonActions.has(action))
: input,},theme: toSpitiMasTheme,studio: {components: {logo: StudioLogo,navbar: StudioNavBar,},},});
I believe this error is due to the nanoid library removing CommonJS support. Nano ID 4 will work only with ESM applications. v4 is what this library depends on. More info here: ai/nanoid#365 & ai/nanoid#364
Error while importing the plugin
Hi there, thansk for this plugin.
I unfortunately encounter an error while including this in the plugins array in
sanity.config.ts
.Error
Schema file
Config:
tscongi.json
Versions:
Any idea how to resolve this issue because I really like to use the plugin 😄
Thanks in advance.
The text was updated successfully, but these errors were encountered: