Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
This is a CLI Docs Enhancement, not another kind of Docs Enhancement.
- This is a CLI Docs Enhancement.
Description of Problem
It might help readers if the overrides documentation made it clear that providing overrides in a package does not change dependency resolution for any project using that package.
For example, consider the following dependency chain (where package-d is not shown but has multiple major version):
{
"name": "package-c",
"version": "1.0.0",
"main": "index.js",
"license": "ISC",
"dependencies": {
"package-d": "1.0.0"
}
}
{
"name": "package-b",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"package-c": "1.0.0"
},
"overrides": {
"package-d": "2.0.0"
}
}
{
"name": "package-a",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"package-b": "1.0.0"
}
}
If I run npm install
on package-b
then package-d
will resolve to 2.0.0
. In contrast if I run npm install
on package-a
then package-d
will resolve to 1.0.0
.
Potential Solution
Add text similar to the following:
Note: Overrides is not transitive. A package that has a dependency with overrides will not respect those overrides.
Docs URL
https://docs.npmjs.com/cli/v9/configuring-npm/package-json?v=true#overrides