Skip to content

trouble loading csv #3511

@endquote

Description

@endquote

Environment

  • Operating System: Darwin
  • Node Version: v24.6.0
  • Nuxt Version: 4.0.3
  • CLI Version: 3.27.0
  • Nitro Version: 2.12.4
  • Package Manager: npm@11.5.1
  • Builder: -
  • User Config: compatibilityDate, devtools, modules, css, content
  • Runtime Modules: @nuxt/content@3.6.3, @nuxt/eslint@1.9.0, @nuxt/image@1.11.0, @nuxt/ui@3.3.2, @vueuse/nuxt@13.7.0
  • Build Modules: -

Version

3.6.3

Reproduction

A reproduction is in the discussion here: #3489

In my use case:

export default defineContentConfig({
  collections: {
    people: defineCollection({
      type: "data",
      source: "org/gdc.csv",
      schema: z.object({
        "Work Email": z.string().email(),
      }),
    }),
  },
});
const { data: tmpContent } = await useAsyncData("tmp-content", () => queryCollection("people").all());
[
  {
    "id": "people/org/gdc.csv",
    "Work Email": null,
    "extension": "csv",
    "meta": {
      "path": "/org/gdc",
      "body": [
        ...my csv data is here...
      ],
      "title": "Gdc"
    },
    "stem": "org/gdc",
    "__hash__": "t_hC0vKvEj6NWa3r_goNjnn4BEvwNnHt6Y8WvNiIUHI"
  }
]

Description

CSV data is not returned from queryCollection as it is for markdown. The result is an array of length 1 with a body attribute that has all the data.

The documentation mentions putting this in the config:

export default defineNuxtConfig({
  content: {
    build: {
      csv: {
        json: true,
      },
    },
  },
});

But it seems to have no effect.

The documentation also seems to have errors. The example schema has "name, email, avatar", then has two example csv files, with "id, name, email", and "name, role, avatar".

Additional context

cc @peter-chipello

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