-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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 12 Module Resolution broken for Yarn 2 PNP #32546
Comments
Tried some further investigating, though I will need to look more into the pnp api, and found that the virtual mapping appears to be part of the issue. Though, webpack used to have some issues that gave very similar output, so I will also be looking into what is going on with webpack when the dev server starts to see if it gives me any further ideas on why these modules are showing that they cannot be resolved or dont exist. I took a look at the pnp.cjs as well and it looks like pretty much everything is mapped the same as it was in 11.1.0, so I am unsure yet where this issue is stemming from |
This issue is related also to yarn v3 ( Related issue: #31812 Temporary workaround: #31812 (comment) |
I did not see the related issue @rtritto mentioned, but the version of yarn I am using is also 3.0.2. I believe all new versions are colloquially referred to as "yarn 2" |
yarn v2 and v3 are both versions of yarn berry. |
@rtritto that's the name of their repo and release cycle, the proper names are yarn 1 or yarn classic and yarn 2 or yarn modern. They refer to all post classic versions as yarn 2 all over their docs and in most of their news releases. Anyway, it doesn't matter, semantics. The point is, yarn (berry or 2 or 3.0.x) pnp resolution is currently broken on next 12 |
Seems to be a duplicate of #32115 |
x-ref [#31552 ](#31552) x-ref #32115 x-ref #32546 x-ref #32721 Since this PR #31455 is merged, `enhanced-resolve` dependency's resolved field is changed which caused broken yarn pnp. I am not sure how this field has been changed or this is intentional or not When I install webpack locally, `enhanced-resolve`'s resolved field in lock file is always `registry.yarnpkg.com` not `codeload.github.com` ## Bug - [x] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint` Co-authored-by: Tobias Koppers <[email protected]> Co-authored-by: JJ Kasper <[email protected]>
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?
16.9.0
What browser are you using?
Chrome
What operating system are you using?
Ubuntu, Windows
How are you deploying your application?
next start
Describe the Bug
I upgraded from next 11.1.0 to the most recent next release 12.0.7 after the eslint issues got fixed and found that deps resolution seems to be slightly broken for yarn 2 pnp. Next 11 was mostly compatible with yarn 2 pnp and various other yarn 2 resolution methods, but next 12 seems to have broken that system. I can't confirm that this holds true for all next 12 releases, but has been confirmed on 12.0.7 and 12.0.6. When running my local dev server, these are some of the errors I am getting:
I have also confirmed in a separate project that next 12 DOES work with yarn 2 nodeLinker resolution mode, but I prefer a zero install method that uses solely yarn cache with no node_modules in pretty much all my projects, that way all deps can be packaged with my repo, which is becoming a more and more popular method with many javascript/nodejs devs with the advent of yarn 2.
Expected Behavior
The expected behavior would be for the nextjs application to compile as normal, as this issue is preventing the whole app from compiling.
To Reproduce
The following steps would allow someone to quickly bootstrap a project like this one:
npm install -g yarn
yarn set version berry
yarn dlx create-next-app .
(If you have to, put the app in a child directory and then re copy paste everything into the parent directory as I dont think my PR that would fix yarn dlx create-next-app . on this repo has been merged. Also make sure version is next 12.0.7)
Ensure that the .yarnrc.yml nodeLinker setting does not have any entry or is set to pnp. Then run the following:
yarn install
yarn dev
The text was updated successfully, but these errors were encountered: