title: How to override a nested npm sub-dependency with a different package altogether (not just different package version number)?
body: <h1>Overview</h1>
  <p>I am having trouble resolving a ReDoS vulnerability identified by <code>npm audit</code>. My application has a nested sub-dependency <code>ansi-html</code> that is vulnerable to attack, but unfortunately, it seems that the <a href="https://github.com/Tjatse/ansi-html/issues/19" rel="nofollow noreferrer">maintainers have gone AWOL</a>. As you can see in the comments section of that Github issue, to get around this problem, the community has made a fork of the repo called <code>ansi-html-community</code> located <a href="https://github.com/mahdyar/ansi-html-community" rel="nofollow noreferrer">here</a>, which addresses this vulnerability.</p>
  <p>Thus, I would like to replace all nested references of <code>ansi-html</code> with <code>ansi-html-community</code>.</p>
  <h1>Problem</h1>
  <p>My normal strategy of using <code>npm-force-resolutions</code> does not seem to be able to override nested sub-dependencies with a different package altogether but rather only the same packages that are a different version number. I have researched this for several hours, but unfortunately, the only way I have found to fix this <a href="https://github.com/Tjatse/ansi-html/issues/19#issuecomment-937690221" rel="nofollow noreferrer">would appear to be with yarn</a>, which I am now seriously considering using instead of npm. However, this is not ideal as our entire CI/CD pipeline is configured to use npm.</p>
  <p>Does anyone know of any other way to accomplish nested sub-dependency package substitution/resolution without having to switch over to using yarn?</p>
  <h1>Related Questions</h1>
  <p>These are questions of interest that I was able to find, but unfortunately, they tend to only discuss methods to override package version number, not the package itself.</p>
  <h5>Discusses how to override version number:</h5>
  <p><a href="https://stackoverflow.com/questions/15806152/how-do-i-override-nested-npm-dependency-versions">How do I override nested NPM dependency versions?</a></p>
  <h5>Has a comment discussion about <code>npm shrinkwrap</code> (not ideal):</h5>
  <p><a href="https://stackoverflow.com/questions/32239240/npm-how-to-override-a-dependent-packages-dependencies">npm - how to override a dependent package&#39;s dependencies?</a></p>