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

Cannot find module './components.cjs.development.js' #41965

Open
1 task done
The-Code-Monkey opened this issue Oct 27, 2022 · 5 comments
Open
1 task done

Cannot find module './components.cjs.development.js' #41965

The-Code-Monkey opened this issue Oct 27, 2022 · 5 comments
Labels
bug Issue was opened via the bug report template.

Comments

@The-Code-Monkey
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64
Binaries:
Node: 16.15.0
npm: 8.5.5
Yarn: 1.22.15
pnpm: 6.11.0
Relevant packages:
next: 13.0.1-canary.0
eslint-config-next: 13.0.0
react: 18.2.0
react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

Im using my own component lib and its working on the homepage but when you go to the list/products page it throw the error.

Cannot find module './components.cjs.development.js'
What is strange is that the file in question is installed as i used it on another page just fine, and then there is no direct link to that file it gets called via the index.js file in the node_modules. which confirms that it is reading the correct filesystem.

Expected Behavior

It should load the file like it does on the previous page.

Link to reproduction

https://github.com/The-Code-Monkey/PaperCMS

To Reproduce

Go to the linked repo and you should be able to see the failed deploy. Its really strange, you might have to load it locally as it runs on dev unless you click the products link, all elements are built using the Box component which is what is failing on the other page. Not sure why.

@The-Code-Monkey The-Code-Monkey added the bug Issue was opened via the bug report template. label Oct 27, 2022
@The-Code-Monkey
Copy link
Author

There is a box component used on every page, whether thats the layout, page or a component, but for some reason only the nested pages break.

@The-Code-Monkey
Copy link
Author

Is there a way to global set use client on all layouts and pages as that i have found fixes everything. probably due to the use of context inside my Component lib.

@The-Code-Monkey
Copy link
Author

I'm glad I'm not the only one who has this issue, the strange one for me though is I've also ran it in es module mode and it still picks up the .cjs version even though I have a compiled esm version. What I can't get my head around is that it works on the route URL but then when you go to a sub URL it crashes. It's actually stopping my build from being successful

@The-Code-Monkey
Copy link
Author

This one fixed for me due to having the components use context so it was crashing. i just had to add use client to all the pages that had a component on.

@vercel-release-bot
Copy link
Collaborator

This issue has been automatically marked as stale due to two years of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you.

@vercel-release-bot vercel-release-bot added the stale The issue has not seen recent activity. label Jan 11, 2025
@nextjs-bot nextjs-bot removed the stale The issue has not seen recent activity. label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

3 participants