如上图,项目依赖4个包,但这4个包又同时依赖同样的包,就会出现重复下载,重复依赖
导致整个项目包很大,该如何解决这个问题?
在仅依赖chokidar、node-sass、uglify-js时,执行npm install后对比
npm2 install:22,118,854 字节npm2 install后dedupe:16,834,945 字节 npm3 install:18,026,936 字节npm3 install后dedupe:15,366,266 字节
npm2 install:22,118,854 字节npm2 install后dedupe:16,834,945 字节
npm3 install:18,026,936 字节npm3 install后dedupe:15,366,266 字节
认证高级PHP讲师
npm 3以后就不是这样的结构了,升级npm到3,然后删除node_modules,重新安装一遍。
2到3是有改变,参考https://docs.npmjs.com/how-np...
To get rid of duplication, we can run:
npm dedupe
The packages marked in your screenshot should be considered as different packages although with same the same package name "async". Because these packages are of different versions.
npm 3以后就不是这样的结构了,升级npm到3,然后删除node_modules,重新安装一遍。
2到3是有改变,参考https://docs.npmjs.com/how-np...
npm dedupe
The packages marked in your screenshot should be considered as different packages although with same the same package name "async". Because these packages are of different versions.