How to update a dependency within a dependency?

606 Views Asked by At

I would like to update a 'handlebars' node module that is a dependency of Vue-Cli (see screenshot).

enter image description here

What's the correct way to do this?

Thank you

1

There are 1 best solutions below

2
CyberEternal On BEST ANSWER

Add a resolutions field to your package.json file and define your version overrides.

It will look like this

{
  ...
  "dependencies": {
    ...
  },
  "devDependencies": {
    ...
  },
  "resolutions": {
    "EXAMPLE_PACKAGE": "EXAMPLE_PACKAGE_NEEDED_VERSION"
  }
}

It shouldn't update the package in the dependency. But your application will use the needed version. It can be useful for example if some dependencies in your dependency have important security updates, and your dependency has not updated the version yet.