Skip to content
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

[DOCS] Document how to replace a dependency with a fork with overrides. #4909

Open
2 tasks done
everett1992 opened this issue May 17, 2022 · 7 comments
Open
2 tasks done
Labels
config:overrides Issues dealing with the overrides feature Documentation documentation related issue Needs Triage needs review for next steps

Comments

@everett1992
Copy link

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

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 foo@1.0.0 with @private/foo-fork@1.0.0 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

@everett1992 everett1992 added Documentation documentation related issue Needs Triage needs review for next steps labels May 17, 2022
@miWatch10
Copy link

miWatch10 commented Jun 2, 2022

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"
  },
@darcyclarke darcyclarke added the config:overrides Issues dealing with the overrides feature label Jul 11, 2022
@stephenjwatkins
Copy link

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:sass@1.54.7",
    "sass-loader": "9.0.3"
  }
}
@kitschpatrol
Copy link

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"
    }
  }
@GeoffreyBooth
Copy link

Is there a way to override with a local file, rather than a package published to the npm registry or GitHub?

@stefanlucas
Copy link

stefanlucas commented May 19, 2023

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.

@phillipwildhirt
Copy link

ditto this

"dependency with a fork" sounds pretty clear to me. So... HOW?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config:overrides Issues dealing with the overrides feature Documentation documentation related issue Needs Triage needs review for next steps
9 participants