contentlayerdev/contentlayer

Compatibility issues with `next.config.mjs`

marcofranssen opened this issue · 4 comments

When running with next.config.mjs the project fails to build.

next dev

   ▲ Next.js 14.0.4
   - Local:        http://localhost:3000
   - Environments: .env

 ○ (serwist) PWA support is disabled.
 ○ (serwist) PWA support is disabled.
 ✓ Ready in 6.8s
Contentlayer config change detected. Updating type definitions and data...
Generated 76 documents in .contentlayer
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/marco/code/priv/nextjs-blog/node_modules/.pnpm/@contentlayer+core@0.3.4_esbuild@0.19.4/node_modules/@contentlayer/core/dist/dynamic-build.js for build dependencies failed at 'import(`file://${compiledConfigPath}`)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/marco/code/priv/nextjs-blog/node_modules/.pnpm/@contentlayer+core@0.3.4_esbuild@0.19.4/node_modules/@contentlayer/core/dist/getConfig/index.js for build dependencies failed at 'import(`file://${modulePath}?x=${Date.now()}`)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/marco/code/priv/nextjs-blog/node_modules/.pnpm/@contentlayer+core@0.3.4_esbuild@0.19.4/node_modules/@contentlayer/core/dist/generation/generate-dotpkg.js for build dependencies failed at 'import(filePathJoin(generatedPkgPath, 'generated', 'index.mjs'))'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'markdown-wasm/dist/markdown.node.js' in '/Users/marco/code/priv/nextjs-blog/node_modules/.pnpm/@contentlayer+core@0.3.4_esbuild@0.19.4/node_modules/@contentlayer/core/dist/markdown'
<w> while resolving 'markdown-wasm/dist/markdown.node.js' in /Users/marco/code/priv/nextjs-blog/node_modules/.pnpm/@contentlayer+core@0.3.4_esbuild@0.19.4/node_modules/@contentlayer/core/dist/markdown as file
<w>  at resolve esm file markdown-wasm/dist/markdown.node.js
<w>  at file dependencies /Users/marco/code/priv/nextjs-blog/node_modules/.pnpm/@contentlayer+core@0.3.4_esbuild@0.19.4/node_modules/@contentlayer/core/dist/markdown/markdown.js
<w>  at file /Users/marco/code/priv/nextjs-blog/node_modules/.pnpm/@contentlayer+core@0.3.4_esbuild@0.19.4/node_modules/@contentlayer/core/dist/markdown/markdown.js
<w>  at resolve esm file ./markdown/markdown.js
<w>  at file dependencies /Users/marco/code/priv/nextjs-blog/node_modules/.pnpm/@contentlayer+core@0.3.4_esbuild@0.19.4/node_modules/@contentlayer/core/dist/index.js
<w>  at file /Users/marco/code/priv/nextjs-blog/node_modules/.pnpm/@contentlayer+core@0.3.4_esbuild@0.19.4/node_modules/@contentlayer/core/dist/index.js
<w>  at resolve esm file @contentlayer/core
<w>  at file dependencies /Users/marco/code/priv/nextjs-blog/node_modules/.pnpm/next-contentlayer@0.3.4_contentlayer@0.3.4_esbuild@0.19.4_next@14.0.4_react-dom@18.2.0_react@18.2.0/node_modules/next-contentlayer/dist/plugin.js
<w>  at file /Users/marco/code/priv/nextjs-blog/node_modules/.pnpm/next-contentlayer@0.3.4_contentlayer@0.3.4_esbuild@0.19.4_next@14.0.4_react-dom@18.2.0_react@18.2.0/node_modules/next-contentlayer/dist/plugin.js
<w>  at resolve esm file ./plugin.js
<w>  at file dependencies /Users/marco/code/priv/nextjs-blog/node_modules/.pnpm/next-contentlayer@0.3.4_contentlayer@0.3.4_esbuild@0.19.4_next@14.0.4_react-dom@18.2.0_react@18.2.0/node_modules/next-contentlayer/dist/index.js
<w>  at file /Users/marco/code/priv/nextjs-blog/node_modules/.pnpm/next-contentlayer@0.3.4_contentlayer@0.3.4_esbuild@0.19.4_next@14.0.4_react-dom@18.2.0_react@18.2.0/node_modules/next-contentlayer/dist/index.js
<w>  at resolve esm file next-contentlayer
<w>  at file dependencies /Users/marco/code/priv/nextjs-blog/next.config.mjs
<w>  at file /Users/marco/code/priv/nextjs-blog/next.config.mjs
<w>  at resolve commonjs /Users/marco/code/priv/nextjs-blog/next.config.mjs

Also see serwist/serwist#39

did u got any solution??

@jabedzaman unfortunately not :(

Starting to feel nervous about contentlayer's future. The last merge was 5 months ago. If you're using ESM, you may need to eject from contentlayer.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.