yarn why
显示有关为何安装包的信息。
yarn why <query>
此命令将识别为何安装包,例如,详细说明哪些其他包依赖于它或是否在 package.json
清单中明确标记为依赖项。
yarn why jest
yarn why vx.x.x
[1/4] 🤔 Why do we have the module "jest"...?
[2/4] 🚚 Initializing dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
info Has been hoisted to "jest"
info This module exists because it's specified in "devDependencies".
info Disk size without dependencies: "1.29kB"
info Disk size with unique dependencies: "101.31kB"
info Disk size with transitive dependencies: "20.35MB"
info Amount of shared dependencies: 125
查询参数
yarn why
的强制查询参数可以是
- 包名称(如上例所示)
- 包文件夹;例如:
yarn why node_modules/once
- 包文件夹中的文件;例如:
yarn why node_modules/once/once.js
文件位置也可以是绝对位置。