I came across this post: How can I change nested NPM dependency versions?
Unfortunately, the solution provided did not work for me.
I am attempting to modify a package to utilize a different version of a specific dependency instead of the one it currently uses.
Does the package itself dictate which version of a dependency to use, or is there a way to override it?
In my situation, I want to switch out css-loader
's default reliance on
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e48797978a858a8ba4d7cad5d4cad4">[email protected]</a>
(latest) and replace it with <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d8bbababb6b9b6b798ecf6e8f6e8f5aabbf6ea">[email protected]</a>
(next).
In a response in the link above, user trickpatty mentions:
This change will be undone whenever you run npm i. Instead of modifying your package-lock.json file by adding the child dependency to "dependencies", add the child dependency to the "dependencies" section of your package.json.
Even after including
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="593a2a2a37383736196d77697769742b3a776b">[email protected]</a>
in the devDependencies of my package.json, there was no impact on css-loader
. It continued to use the default version of cssnano
.