contentlayerdev / contentlayerdev/website

next.js build: building contentlayer prior to TSC or adding more clear docs

Open
#105 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
132
Forks
57
PR merge metrics
No merged PRs in 30d

Description

When following the official Getting Started example for Next.js, the app fails to build on CI or any environemnt where `.contentlayer` doesn't exist already.

This appears to be because TSC runs _prior_ to contentlayer, which errors out.

I'm not sure if this can be changed at all (to run a Next plugin prior to the TSC step). That would seem like the ideal solution, but otherwise, would be great to update the documentation & examples to modify the build step

```json
"scripts": {
"build": "contentlayer && next build"
}
```

I'm happy to make a PR to help out, just wanted to check if this is indeed an issue that others experience or if I'm really missing something basic

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the official Getting Started example and its package.json build script, then reproduce the CI failure in an environment without .contentlayer. Check whether the documented build command needs Contentlayer to run first; done means the example builds successfully and the documentation reflects the required command or confirmed supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, typescript
Domain
build-system, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.