-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
base: main
Are you sure you want to change the base?
Conversation
Hi @russell-dot-js! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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. |
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)"