verifyPackageTree is checking dependencies in parent directories#5148
verifyPackageTree is checking dependencies in parent directories#5148mcampa wants to merge 1 commit into
Conversation
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up 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 the corporate CLA signed. 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! |
|
This is the intended functionality because the Node module resolution algorithm doesn't stop at the process' cwd. We'd like to err to the conservative side and keep this behavior. What about when/if you accidentally import a package from the root repo instead of your client's project? |
|
I expect this will come up a lot so maybe we should revisit and make the check more conservative. We should just make sure it still covers reported issues for which it was added first. We should still have links to them. |
|
I do think it was related to the monorepo support. @Timer While I know we don't compile monorepos now, do we still allow to put CRA inside a monorepo with hoisted |
|
We might want to make this part more prominent: This doesn't block you when that setup is intentional. I think it'll still be helpful to people as a way to stop cryptic issues. |
Yes, or we should, at least. I can test this more but it works afaik. |
|
We should have tests for this. |
|
I'm hitting this use case as well. The provided warnings are very helpful, and the workaround instructions regarding For context, I am encountering this issue from using a local development workflow manager repo which depends on jest of a lower version. This repo is a parent to all the applications I work on. As is, this warnings will trigger unless all my applications are running dependencies of the same version. |
I'm upgrading a project to use version 2.0.0 and found the following issue:
The problem is that my project is nested inside a legacy repository that contains a different
node_modulesat the root.Something like this:
verifyPackageTree.jsis checking dependencies at the root level instead of stoppingmy-react-app/Workaround
Fix
Stop going up the directory tree until it gets to the current directory
process.cwd()