We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
contentlayer.config.ts
contentlayer.config.js
I'm trying to configure my blogs/docs using contentlayer in a Next.js project.
contentlayer
"next": "14.2.5", "contentlayer": "^0.3.4", "next-contentlayer": "^0.3.4",
When I run yarn contentlayer build or yarn contentlayer dev, I receive the following error:
yarn contentlayer build
yarn contentlayer dev
Warning: Contentlayer might not work as expected on Windows Could not find contentlayer.config.ts or contentlayer.config.js in `your source`
The contentlayer.config.js file is located at the root of my project, and my configuration looks like this:
import { defineDocumentType, makeSource } from "contentlayer/source-files"; /** @type {import('contentlayer/source-files').ComputedFields} */ const computedFields = { slug: { type: "string", resolve: (doc) => `/${doc._raw.flattenedPath}`, }, slugAsParams: { type: "string", resolve: (doc) => doc._raw.flattenedPath.split("/").slice(1).join("/"), }, }; export const Doc = defineDocumentType(() => ({ name: "Doc", filePathPattern: `docs/**/*.mdx`, contentType: "mdx", fields: { title: { type: "string", required: true, }, description: { type: "string", }, published: { type: "boolean", default: true, }, }, computedFields, })); export default makeSource({ contentDirPath: "./content", documentTypes: [Doc] });
Here’s my directory structure:
project ├── app ├── package.json ├── contentlayer.config.js ├── tsconfig.json └── ...rest
Is contentlayer not compatible with the latest Next.js version, or is there something wrong with my configuration? Any help would be appreciated!
The text was updated successfully, but these errors were encountered:
facing a similar issue, did you found any solution to it?
Sorry, something went wrong.
No branches or pull requests
I'm trying to configure my blogs/docs using
contentlayer
in a Next.js project.When I run
yarn contentlayer build
oryarn contentlayer dev
, I receive the following error:The
contentlayer.config.js
file is located at the root of my project, and my configuration looks like this:Here’s my directory structure:
Is
contentlayer
not compatible with the latest Next.js version, or is there something wrong with my configuration? Any help would be appreciated!The text was updated successfully, but these errors were encountered: