Skip to content

Cannot find module 'astro:content' #5711

@azan-n

Description

@azan-n

What version of astro are you using?

1.8.0

Are you using an SSR adapter? If so, which one?

No

What package manager are you using?

npm, pnpm

What operating system are you using?

macOS 13

Describe the Bug

I have been eagerly waiting for even a beta of the Content Collections RFC to start shipping my blog. Thanks to @bholmesdev I got a chance much earlier than I could expect. I upgraded from 1.6.4(?) to 1.8.0 but I got the TS error Cannot find module 'astro:content' or its corresponding type declarations.ts(2307) when trying to import the defineCollection function.

Steps to reproduce

  1. pnpm create astro@latest or npm create astro@latest
  2. Create a 'content' directory and create a 'config.ts' within the folder
  3. Write import { defineCollection, z } from "astro:content" within the 'config.ts'

Continuing with this state of the application leads to no errors during the build or in the dev server.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-j2falm?file=content/config.ts

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

Labels

- P3: minor bugAn edge case that only affects very specific usage (priority)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions