Skip to content

Update README.md to highlight the fix of compatibility with next.js 15 + turbopack #86

New issue

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions packages/contentlayer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,38 @@ Since **contentlayer2** doesn't have any breaking API changes, hopefully this is

Otherwise, see below for common compatibility issues. ❤️‍🩹

## Compatibility with Next.js 15 + Turbopack

If you're running your project in development mode with the `--turbopack` flag, the `.contentlayer` folder might not be generated correctly. This can break Contentlayer integration and cause missing features.

To fix this while still benefiting from Turbopack, you can run Contentlayer and Next.js in parallel using [`npm-run-all`](https://www.npmjs.com/package/npm-run-all).

### Steps to resolve

1. Install `npm-run-all` as a dev dependency:

```bash
npm i -D npm-run-all
```
2. Update your `package.json` scripts:

```json
{
"scripts": {
"dev:contentlayer": "contentlayer2 dev",
"dev:next": "next dev --turbopack",
"dev": "run-p dev:*"
}
}
```

3. Now, you can run:

```bash
npm run dev
```
This will start both Contentlayer and Next.js together — fully compatible with Turbopack. 👌

#### Upgrading incompatible Remark and Rehype packages

While **contentlayer2** is API compatible with **contentlayer**, it has been updated to use the latest ([**v11+**](https://github.com/unifiedjs/unified/releases/tag/11.0.0)) [Unified](https://unifiedjs.com/) toolchain. If your configuration includes [Remark](https://remark.js.org/) or [Rehype](https://github.com/rehypejs/rehype) plugins, you'll likely need to upgrade them.
Expand Down