Skip to content

Nuxt Studio: Error "We're not able to parse the code syntax (json or yaml)" with content.config.ts #3459

@sdnteja2

Description

@sdnteja2

Environment



Version

v3

Reproduction

https://github.com/sdnteja2/sdnteja2.sch.id/blob/master/content.config.ts

Description

When using Nuxt Studio with the collection configuration in content.config.ts, the following error appears:

We're not able to parse the code syntax (json or yaml). Please check the data structure.

The file structure follows the official documentation and is valid TypeScript. Here is an example of the structure used:

import { defineCollection, defineContentConfig, z } from '@nuxt/content'

export default defineContentConfig({
  collections: {
    content: defineCollection({
      type: 'page',
      source: {
        include: '*.md',
        exclude: ['berita/**', 'guru/**'],
      },
      schema: z.object({
        title: z.string(),
        description: z.string(),
        seo: z.intersection(
          z.object({
            title: z.string().optional(),
            description: z.string().optional(),
            meta: z.array(z.record(z.string(), z.any())).optional(),
            link: z.array(z.record(z.string(), z.any())).optional(),
          }),
          z.record(z.string(), z.any()),
        ).optional().default({}).editor({ hidden: true }),
        navigation: z.object({
          icon: z.string().editor({ input: 'icon' }),
        }),
      }),
    }),
    // ... other collections such as berita, guru, artikel, etc.
  },
})

Additional context

Steps to Reproduce

  • Run Nuxt Studio on a project with the above configuration.
  • Open the collection page in Nuxt Studio.
  • The error appears: We're not able to parse the code syntax (json or yaml). Please check the data structure.

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions