rt:如果我的多仓目录每个项目都需要react 如何能一次给所有项目都安装react
我目前使用的是pnpm管理依赖,当我试图在根目录安装时:
ERR_PNPM_ADDING_TO_ROOT Running this command will add the dependency to the workspace root, which might not be what you want - if you really meant it, make it explicit by running this command again with the -w flag (or --workspace-root). If you don't want to see this warning anymore, you may set the ignore-workspace-root-check setting to true.
可以看到如果只是单纯的在根目录安装依赖真的会安装到根目录而非工作区的每个目录。
我现在想到了两个方案但都没找到具体的工具,不知道是不是思路错了
- 我缺失了某种参数,npm/pnpm/yarn自身工作区可以实现这个目的
- 就安装到根目录,但工作目录的package.json可以从根目录拓展。根目录依赖是公共依赖
以上,如果有知道的大佬,不胜感激。