Skip to content
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

next 14.2.4 type:module give error #20

Open
tianyingchun opened this issue Jun 18, 2024 · 10 comments
Open

next 14.2.4 type:module give error #20

tianyingchun opened this issue Jun 18, 2024 · 10 comments

Comments

@tianyingchun
Copy link

Generated 13 documents in .contentlayer
✓ Ready in 3.7s
○ Compiling / ...
✓ Compiled / in 4.9s (1255 modules)
GET / 200 in 5301ms
✓ Compiled in 340ms (580 modules)
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/tianyingchun/Documents/hyperse-internal/hyperse-blog/node_modules/@contentlayer2/core/dist/generation/generate-dotpkg.js for build dependencies failed at 'import(URL.pathToFileURL(filePathJoin(generatedPkgPath, 'generated', 'index.mjs')).href)'.
Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.

@tianyingchun
Copy link
Author

"contentlayer2": "0.4.6",
"next-contentlayer2": "0.4.6",

@timlrx
Copy link
Owner

timlrx commented Jun 22, 2024

Sorry, could you elaborate on what causes the error and provide a small reproducible is possible?

@tianyingchun
Copy link
Author

okay, i will find time to make a small reproduce repo

@yangchristina
Copy link

yangchristina commented Jun 23, 2024

Am also getting this, npm run dev works fine, but no posts show up on build

Edit: oops, posts do show up, I set draft to true by accident. Despite this error, everything still appears to be running fine.

@timlrx
Copy link
Owner

timlrx commented Jun 23, 2024

Could you include more information on the version of Next and React that you are using as well. I just tested on Next 15 canary and React 19 without issue - https://stackblitz.com/edit/github-ekmxur-ba82kk?file=package.json

@tianyingchun
Copy link
Author

see here
https://github.com/tianyingchun/tailwind-nextjs-starter-blog-issue

  1. yarn install
  2. yarn dev
  3. see below
image

@tianyingchun
Copy link
Author

also see latest commit
tianyingchun/tailwind-nextjs-starter-blog-issue@4e8b693

@timlrx
Copy link
Owner

timlrx commented Jun 23, 2024

Ah this is the same issue as contentlayerdev/contentlayer#313. It's a Webpack warning that can be ignored: webpack/webpack#15688. Or if you don't use "type": "module", you can avoid this error as well.

@tianyingchun
Copy link
Author

yes, i know, but don't know why, i just switch to turbo & webpack in memory cache.

@ham-evans
Copy link

ham-evans commented Aug 13, 2024

I'm getting this too with "contentlayer2": "^0.5.0". Definitely triggered by "type": "module" in package.json but would be awesome if there was a way to remove it.

is proposed solution adding this to next.config under the webpack? (see here)

config.infrastructureLogging = {
      level: "error",
    };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants