contentlayerdev / contentlayer

Contentlayer turns your content into data - making it super easy to import MD(X) and CMS content in your app
https://www.contentlayer.dev
MIT License
3.24k stars 200 forks source link

<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /node_modules/@contentlayer/core/dist/generation/generate-dotpkg.js for build dependencies failed at 'import(filePathJoin(generatedPkgPath, 'generated', 'index.mjs'))'. #667

Open JamesIves opened 1 month ago

JamesIves commented 1 month ago

Been seeing this warning as of late, and I'm unsure what the actual cause is here. Seems to stem from generate-dotpkg.js.

<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of 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.
    [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo]  at file dependencies node_modules/@contentlayer/core/dist/generation/generate-dotpkg.js
     at file node_modules/@contentlayer/core/dist/generation/generate-dotpkg.js
     at resolve esm file ./generation/generate-dotpkg.js
     at file dependencies node_modules/@contentlayer/core/dist/index.js
     at file node_modules/@contentlayer/core/dist/index.js
     at resolve esm file @contentlayer/core
     at file dependencies node_modules/next-contentlayer/dist/plugin.js
     at file node_modules/next-contentlayer/dist/plugin.js
     at resolve esm file ./plugin.js
     at file dependencies node_modules/next-contentlayer/dist/index.js
     at file node_modules/next-contentlayer/dist/index.js
     at resolve esm file next-contentlayer
     at file dependencies next.config.mjs
     at file next.config.mjs
     at resolve commonjs next.config.mjs
    [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] SyntaxError: Unexpected token 'i', "filePathJoi"... is not valid JSON
        at JSON.parse (<anonymous>)
        at parseString (node_modules/next/dist/compiled/webpack/bundle5.js:28:260457)
        at node_modules/next/dist/compiled/webpack/bundle5.js:28:276877
        at node_modules/next/dist/compiled/webpack/bundle5.js:1:268942
        at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3)
        at FSReqCallback.callbackTrampoline (node:internal/async_hooks:130:17)

Versions:

"next": "14.2.4",
"next-contentlayer": "0.3.4",
"contentlayer": "0.3.4",
abolfazlcodes commented 1 month ago

Did you find anything to solve this issue? Also the package seems to be in beta and installing other packages we should use --legacy-peer-deps.

abolfazlcodes commented 4 weeks ago

I added this to my package.json and it resolved the logs @JamesIves:

"overrides": { "next-contentlayer": { "next": "$next" } }