Bugs: Next.js v16 compatibility of `createContentCollectionPlugin`
Hey there 👋
After updating to Next.js v16 we get several minor content-collections related issues. The core functionality works, but:
- We get a little type issue in
next.config.ts:
Forcing it like nextConfig = withContentCollections(nextConfig) as NextConfig fixes it for us right now.
- When using scripts with
bun --bun …the content-collections compilation occurs twice:
Without --bun it only compiles once. Might be bun-related ofc, but maybe not 🤷♂️
Sorry for the delay. I was on vacation. Which version of the next adapter are you using?
Also, addition to the first issue: If I try to await (which the type error seems to indicate), I get:
> Build error occurred
Error: require() cannot be used on an ESM graph with top-level await. Use import() instead. To see where the top-level await comes from, use --experimental-print-required-tla.
The type error looks like your nextConfig variable has the type NextConfig, but the content collections plugin returns Promise<Partial<NextConfig>>, which is totally fine as the result (export) of next.config.ts. I think the easiest fix for the problem is to just export the result of withContentCollections directly.
Can you provide a sample repository for the bun problem?