Yue JIN
Yue JIN

Reputation: 2066

How to remove a nested dependency in pnpm

For example in my project I include svgo which has a deprecated dependency stable which results into warning during installation:

 WARN  deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility

I can remove this package from source code of svgo via pnpm patch, but how to also exclude it from package resolution to avoid PNPM WARN?

If I manually remove stable package from lock file, it will appear again after using pnpm update.

Upvotes: 2

Views: 1501

Answers (1)

Codebling
Codebling

Reputation: 11382

svgo will fail without stable

If you remove stable, svgo won't run, because it uses stable.

Fork instead

Instead, you should fork the package make the necessary code changes to svgo, then use your modified. Thanksfully, people on the internets have already done this for you.

All you need to do is

npm i boidolr/svgo#remove-stable

This should replace svgo with the edited version that has no stable.

Upvotes: 2

Related Questions