[DOCS] Document how to replace a dependency with a fork with overrides.
Is there an existing issue for this?
- [X] I have searched the existing issues
This is a CLI Docs Enhancement, not another kind of Docs Enhancement.
- [X] This is a CLI Docs Enhancement.
Description of Problem
If you need to make specific changes to dependencies of your dependencies, for example replacing the version of a dependency with a known security issue, replacing an existing dependency with a fork https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides
This sounds like you can replace [email protected] with @private/[email protected] but the examples and documentation do not explain how to.
Potential Solution
If this is supported please document it, if it isn't please remove the references to replacing an existing dependency with a fork
Docs URL
https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides
Any update on this in the doc?
FWIW, this seems to work for me, found it on a different Github repo being used:
Note: it does not work, at least in my case, if I try limiting the version of jsonlint being matched, it only works if it's open and freeform version to override.
"overrides": {
"jsonlint": "npm:@prantlf/jsonlint@^11.6.0"
},
Ran into the same confusion. In my case I needed to swap out node-sass for sass. @miWatch10's suggestion of the npm: prefix was the only thing that ended up working but it's admittedly not intuitive.
"overrides": {
"dependency": {
"node-sass": "npm:[email protected]",
"sass-loader": "9.0.3"
}
}
One more example in case it helps out anyone else... this successfully targets a specific branch ("modernize" in this case) from a GitHub fork that's not published to NPM:
"overrides": {
"node-jq": {
"bin-build": "github:brave/bin-build#modernize"
}
}
Is there a way to override with a local file, rather than a package published to the npm registry or GitHub?
Is there a way to override with a local file, rather than a package published to the npm registry or GitHub?
I`m interested on an answer for the question above too.
https://docs.npmjs.com/cli/v9/configuring-npm/package-json
ditto this
"dependency with a fork" sounds pretty clear to me. So... HOW?