Skip to content

Conversation

@MaxBlack-dev
Copy link
Contributor

Description

This PR adds documentation for how to replace a dependency with a fork using the overrides field in package.json. While the existing documentation mentioned this capability, it didn't provide any examples of how to actually do it.

Changes

  • Added a new subsection "Replacing a dependency with a fork" under the overrides section
  • Documented three methods for replacing dependencies:
    • Using npm: prefix to replace with a different package name
    • Using GitHub repositories (with branches, tags, or commits)
    • Using local file paths
  • Included practical examples for each method
  • Added example showing how to replace a transitive dependency with a fork

Context

Users were confused by the documentation stating you can replace "an existing dependency with a fork" but not explaining how. The issue thread shows multiple users asking for clarification and sharing their own discovered solutions. This PR consolidates those working examples into the official documentation.

Closes #4909

@MaxBlack-dev MaxBlack-dev requested a review from a team as a code owner November 30, 2025 01:49
@owlstronaut owlstronaut merged commit 4850639 into npm:latest Dec 1, 2025
8 checks passed
@github-actions github-actions bot mentioned this pull request Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants