-
Notifications
You must be signed in to change notification settings - Fork 604
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
[rush] pnpm fails to resolve peer dependencies of workspace package #2820
Comments
If I'm understanding correctly, you should be able to resolve your issue by adding |
@D4N14L thanks for reply!I think it can not resolve my issue. {
"name": "email-libs",
"devDependencies": {
"react": ">=16.9.0",
"react-dom": ">=16.9.0"
}
} and then I got react
That why I use peer dependency to make |
Peer dependencies are simply a constraint, they do not instruct the package manager to install that package as a dependency. This is why you should add one version as a I believe you may be able to add just the types as a devDependency and to your tsconfig to be able to build. |
Yes,in my usually case, I also add one version as a devDependency,and specifies more a wider version scope in peerDependencies; As the example above, |
Try adding the types without adding the dependency itself. This should allow you to reference |
Hi @D4N14L ,thanks for reply! Adding the types can't solve this problem, it still can't resolve the
or just make ConsistentVersions to avoid these issues. (I still hope package manager treat workspace packages similarly to npm packages 🤣 If you have any idea, please share to me ,thanks again! |
I think zkochan is probably correct in this instance, and that should work for you. Using just the types might work if you use |
This issue is solved with the new dependenciesMeta.injected feature of pnpm. |
Summary
pnpm fails to resolve peer dependencies of workspace package, is there any good way to solve this problem?
Repro steps
Expected result:
peer dependencies get resolve in host dependencies
Actual result:
peer dependencies fails to resolve
Details
Let's say I have packages
email-page1-react17
,email-page2-react16
andemail-libs
Both
email-page1-react17
andemail-page2-react16
useemail-libs
by"email-libs": "workspace:*"
from local,email-page1-react17/package.json
email-page2-react16/package.json
email-libs/package.json
In this case,
email-page1-react17
andemail-page2-react16
run dev/build and can't resolve 'react', because it just linkpages project's node_modules
email-libs
to the source code location ofemail-libs
, and there is no "react" or "react-dom"Here is the repo show the case: https://github.com/Measy/rush-pnpm-peer-workspace
Is there any good way to solve this problem, thanks for reply!
Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/rush
globally installed version?rushVersion
from rush.json?useWorkspaces
from rush.json?node -v
)?Related : pnpm/pnpm#2174, pnpm/pnpm#3558
The text was updated successfully, but these errors were encountered: