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

fix: give precedence to pnp over node_modules, close #288 #289

Merged
merged 2 commits into from
Apr 19, 2021
Merged

fix: give precedence to pnp over node_modules, close #288 #289

merged 2 commits into from
Apr 19, 2021

Conversation

noahnu
Copy link
Contributor

@noahnu noahnu commented Apr 15, 2021

Fixes #288.

Ideally, node_modules should not even be considered if the pnp api is enabled, however it looks like that's intentional according to #273

@noahnu noahnu changed the title fix: give precendence to pnp over node_modules, close #288 fix: give precedence to pnp over node_modules, close #288 Apr 15, 2021
@codecov
Copy link

codecov bot commented Apr 15, 2021

Codecov Report

Merging #289 (20caa8a) into master (f08fe3f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #289   +/-   ##
=======================================
  Coverage   94.93%   94.93%           
=======================================
  Files          39       39           
  Lines        1579     1581    +2     
=======================================
+ Hits         1499     1501    +2     
  Misses         80       80           
Impacted Files Coverage Δ
lib/ResolverFactory.js 97.12% <100.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f08fe3f...20caa8a. Read the comment docs.

@alexander-akait
Copy link
Member

hm, why developers have node_modules and use yarn PnP, I think yarn should print error/warning here

@merceyz
Copy link
Contributor

merceyz commented Apr 16, 2021

It happens when using the portal: protocol to a project that uses node_modules, for example Next.js uses Yarn 1 with node_modules but has e2e tests using Yarn 2 with PnP that uses the built sources from the Yarn 1 project

https://github.com/vercel/next.js/blob/15133b47ec7bfc413aa068d92fb678626cf47571/test-pnp.sh#L40

@noahnu
Copy link
Contributor Author

noahnu commented Apr 16, 2021

Another example which prompted this PR/issue:

At my work we have 2 projects. Project A using yarn pnp and Project M using node_modules. Project M is a monorepo. Right now if you try to link a package from Project M into Project A, the peer dependencies of the Project M package are resolved using Project M's node_modules, rather than Project A's dependencies. If the peer deps include React, you get singleton issues preventing React hooks from working, among other features.

@merceyz
Copy link
Contributor

merceyz commented Apr 18, 2021

Since Next.js started using webpack 5 by default this is also affecting their e2e tests https://github.com/vercel/next.js/runs/2373726821#step:5:222, applying the change in this PR fixes their e2e tests cc @sokra

@sokra sokra merged commit 1302f10 into webpack:master Apr 19, 2021
@sokra
Copy link
Member

sokra commented Apr 19, 2021

Thanks

kodiakhq bot pushed a commit to vercel/next.js that referenced this pull request Apr 19, 2021
Fixes the e2e PnP tests by updating `enhanced-resolve` to get the fix in webpack/enhanced-resolve#289, the tests started failing in #23810

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## 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.

## Documentation / Examples

- [ ] Make sure the linting passes
SokratisVidros pushed a commit to SokratisVidros/next.js that referenced this pull request Apr 20, 2021
Fixes the e2e PnP tests by updating `enhanced-resolve` to get the fix in webpack/enhanced-resolve#289, the tests started failing in vercel#23810

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## 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.

## Documentation / Examples

- [ ] Make sure the linting passes
@noahnu noahnu deleted the bugfix/288 branch April 24, 2021 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: linked package incorrectly uses node_modules instead of pnpapi
5 participants