pnpm: set the overrides but it looks like not work
pnpm version:
6.17.0
Code to reproduce the issue:
Recently, out project change from yarn to pnpm because of its speed. But when I install the modules, I find it not like what we expected.(Maybe I think the overrides property is like yarn resolution) Here is the package.json code
{
"dependencies": {
"@editor-kit/core": "3.37.0-rc.0"
}
"pnpm": {
"overrides": {
"@editor-kit/core": "3.37.0-rc.0"
}
}
}
Here is the node_modules Topology in .pnpm folder after pnpm install
Also in pnpm-lock.yaml file, I find the same version package(@editor-kit/core) with different hash.
Expected behavior:
Just one package will be install when I set the overrides
Actual behavior:
Many package, and these package have same version with different hash. Really expecting a reply!
Additional information:
Old and large project, there is too much dependencies
node -v
prints: 14.16.0- Windows, macOS, or Linux?: macOS
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 15
- Comments: 20 (2 by maintainers)
It would be great having this work for workspaces
It seems counterintuitive that overrides would not work for workspaces because I was under the impression that workspaces can be used as a feature to coordinate a monorepo containing multiple applications and not just multiple packages. For example I might have the structure:
and my
pnpm-workspace.yaml
looks like thisIt seems advantageous in a large monorepo where apps are owned by different teams that dependency overrides could be specified at the app workspace level. For example if
app-a
andapp-b
both depended uponlib-a
which is consumed as a workspace and not as a published package, iflib-a
hasreact
as a dependency, andapp-a
wants to upgrade toreact@18
whereasapp-b
wants to stay onreact@17
it would seem useful to be able to specify app workspace leveloverrides
rather than global overrides at the rootpackage.json
level. I’m wondering what you would suggest as best practice here @zkochan if it would be better forlib-a
to specifyreact
as apeerDependency
or if there is a way to specify package versions for specific workspaces using something like the PNPM hooks?Seems like one potential solution in yarn for this is no-hoist
Note that overrides seem to be ignored in workspaces. If you use workspaces, what will help is if you move overrides to the root
package.json
(possibly create empty one first).您好,我已收到您的邮件,我会尽快给您回复。
Any update/solution found?
您好,我已收到您的邮件,我会尽快给您回复。
您好,我已收到您的邮件,我会尽快给您回复。
Hello, I believe I’m also running into this issue. (Or quite possibly I’m misunderstanding how overrides work)
I’m seeing the override set in both
package.json
andpnpm-lock.yaml
after runningpnpm audit --fix
, andpnpm install
, however the version of the dependency in the lockfile still shows the old version (in this case minimist 1.2.5), but the override is asking for>=1.2.6
. A few other dependencies have the same problem.Running
pnpm audit
shows no vulns tho.TLDR: it seems overrides are not being applied to
pnpm-lock.yaml
您好,我已收到您的邮件,我会尽快给您回复。
root folder package.json
pnpm-lock.yaml after
pnpm install
still broken for workspaces