简体   繁体   English

如何更新依赖项中的依赖项?

[英]How to update a dependency within a dependency?

I would like to update a 'handlebars' node module that is a dependency of Vue-Cli (see screenshot).我想更新作为Vue-Cli依赖项的“把手”节点模块(见截图)。

在此处输入图片说明

What's the correct way to do this?这样做的正确方法是什么?

Thank you谢谢

Add a resolutions field to your package.json file and define your version overrides.将分辨率字段添加到您的 package.json 文件并定义您的版本覆盖。

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.例如,如果您的依赖项中的某些依赖项具有重要的安全更新,而您的依赖项尚未更新版本,则它会很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM