-
Notifications
You must be signed in to change notification settings - Fork 27.6k
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
Can't resolve dependency when it has only the browser
field
#32714
Comments
browser
field browser
field
browser
field browser
field
When using Next.js 12, the minimum required Node version is I can also see that you are the maintainer of the package, so I suggest reading this discussion to make sure you bundle/publish the package according to the standards: #31518 (comment)
|
So the NPM documentation is wrong?
I read the discussion starting from the comment that you linked, and it looks like that Pauan is correct when complaining that Nextjs is breaking the standard. I updated my package because it's my toy project, but I don't know if other libraries author are going to do the same. Furthermore, I had a similar discussion on |
So to be more precise. We don't support when only
|
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
12.0.7
What version of Node.js are you using?
v12.18.4
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
The error happens locally
Describe the Bug
If a dependency doesn't have the field
main
in thepackage.json
, the errorModule not found: Can't resolve 'dependency-name'
is raised.Expected Behavior
It should work since a dependency could not have the field
main
if it's only for the browser. In this case, the fieldbrowser
is filled.NPM doc is reasonable when explaining that it's an "instead of". Otherwise, I'm losing the hint that it's only for the browser.
To Reproduce
I created an example repository: https://github.com/macabeus/next-js-react-gba-js
Everything works well.
But if you downgrade the package
react-gbajs
to1.0.0
, or remove the fieldmain
atnode_modules/react-gbajs/package.json
, the error is raised.The text was updated successfully, but these errors were encountered: