You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to have a monorepo package that declares a peerDependency, but doesn't install it. Installing it has the effect of causing it to reference that version of the dependency when run within the monorepo. That is incorrect behavior, I want it to never install and always depend on the depending package's installation. (When useWorkspaces is set to true, this works correctly).
When autoInstallPeers is false (via pnpm-config.json or .npmrc, and useWorkspaces is set to false, Rush will incorrectly install all peerDependencies of packages in the monorepo.
Have a monorepo package that has a peerDependency declared
Expected result:
The peerDependency is not listed in the package's node_modules folder Actual result:
The peerDependency IS listed in he package's node_modules folder
I'm going to open a PR with a suggested fix, but I think there should be a case specifically for PNPM & autoInstallPeers:false, that checks for peerDeps and excludes them from being added to the tempDependencies Map.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
Question
Answer
@microsoft/rush globally installed version?
5.130.2
rushVersion from rush.json?
5.130.2
useWorkspaces from rush.json?
false
Operating system?
Mac
Would you consider contributing a PR?
Yes
Node.js version (node -v)?
20.15.1
The text was updated successfully, but these errors were encountered:
Is there a reason why you can't enable workspaces in your repo?
Hi @iclanton, Our repository is mature, and we've had difficulty getting a correctly installed & passing build we're confident in when attempting to enable useWorkspaces. We'd like to enable it, but it's not straightforward for us.
Summary
I would like to have a monorepo package that declares a peerDependency, but doesn't install it. Installing it has the effect of causing it to reference that version of the dependency when run within the monorepo. That is incorrect behavior, I want it to never install and always depend on the depending package's installation. (When useWorkspaces is set to true, this works correctly).
When
autoInstallPeers
is false (viapnpm-config.json
or.npmrc
, and useWorkspaces is set to false, Rush will incorrectly install all peerDependencies of packages in the monorepo.Repro steps
See repro repo here
But:
autoInstallPeers:false
Expected result:
The peerDependency is not listed in the package's node_modules folder
Actual result:
The peerDependency IS listed in he package's node_modules folder
Details
This problem is caused by
RushInstallManager
's usage ofPackageJsonEditor.dependencyList
. It adds peerDependencies to the same list as regular dependencies. This makes sense if autoInstallPeers is false, but not when it's true.I'm going to open a PR with a suggested fix, but I think there should be a case specifically for PNPM & autoInstallPeers:false, that checks for peerDeps and excludes them from being added to the
tempDependencies
Map.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
)?The text was updated successfully, but these errors were encountered: