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(ModuleScopePlugin): support pnp in workspaces #11237

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

russell-dot-js
Copy link

Fixes #10508, #9226, #8757

I cannot take credit for this fix - @Xerkus wrote it here:
#10508 (comment)

I am only PR'ing this as yarn2 lists create-react-app as compatible with PnP, but create-react-app does not work with workspaces .. kind of funny considering create-react-app is a yarn workspace itself :)

Verified by adding resolution on react-dev-utils: "#10508 (comment)"

image

@facebook-github-bot
Copy link

Hi @russell-dot-js!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@@ -35,6 +35,12 @@ class ModuleScopePlugin {
) {
return callback();
}
if (process.versions.pnp) {
const {findPackageLocator} = require('pnpapi');
if (findPackageLocator(request.__innerRequest_request) !== null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be true for any absolute path, not just workspaces

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a complete check and most likely not even a part of a proper check. The idea was to see if file can be resolved to be belonging to one of the packages declared as a dependency, but that does not guarantee that it is required via dependency and not directly.
I assume that is what it does but I don't actually know.

@stale
Copy link

stale bot commented Jan 9, 2022

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Jan 9, 2022
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.

False positive in ModuleScopePlugin with yarn2 "workspace:*" packages
4 participants