【问题标题】:package.json know if there are any dependencies that are not usedpackage.json 知道是否有任何未使用的依赖项
【发布时间】:2021-02-18 14:55:32
【问题描述】:

我有一个依赖项目,我想知道哪些依赖项从未使用过。

例如我有以下依赖项:

 "dependencies": {
    "axios": "^0.19.2",
    "d3": "^5.16.0",
    "d3-scale": "^3.2.2",
    ...
}

假设在我的项目中我从未使用过我安装了 d3 的依赖项,我希望将它报告给我。

如何获取已安装但未使用的所有依赖项的列表?

【问题讨论】:

    标签: json npm package package.json


    【解决方案1】:

    有一个package

    npm install -g depcheck
    

    在你的项目目录中运行

    depcheck
    

    查看结果

    Unused dependencies
    * chalk
    * express
    Unused devDependencies
    * nodemon
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-18
      • 1970-01-01
      • 2016-11-05
      • 2018-12-25
      • 1970-01-01
      相关资源
      最近更新 更多