Has anyone used `overrides` in npm packages to solve dependencies version issues?

I refer to this section of the npm documentation here.

To quote:

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, or making sure that the same version of a package is used everywhere, then you may add an override.

Overrides provide a way to replace a package in your dependency tree with another version, or another package entirely. These changes can be scoped as specific or as vague as desired.

Not just for security reasons (where Snyk always flags a ton) but more so for packages that have dependencies that have dependencies and several level deeper you’re stuck with an old version that breaks your code.

Right now I have such an example which unfortunately breaks one of my Lambda functions.

Thanks!

I’ve used in the past and it works fine.

It’s not great as in Java where you are sure you just have one class for sure in the classpath but it should work ok.

I would double check my node_modules just in case, to be sure they are not duplicated there :slight_smile:

1 Like