首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

关于 npm 和 yarn 总结一些细节

Searches the local package tree and attempts to simplify the overall structure by moving dependencies further up the tree, where they can be more effectively shared by multiple dependent packages. For example, consider this dependency graph: a +-- b <-- depends on c@1.0.x | `-- c@1.0.3 `-- d <-- depends on c@~1.0.9 `-- c@1.0.10 In this case, npm dedupe will transform the tree to: a +-- b +-- d `-- c@1.0.10 Because of the hierarchical nature of node's module lookup, b and d will both get their dependency met by the single c package at the root level of the tree. 复制代码 // npm7 以后微调 // 在保持上述原则的基础上,升级了如下细微的规则: In some cases, you may have a dependency graph like this: a +-- b <-- depends on c@1.0.x +-- c@1.0.3 `-- d <-- depends on c@1.x `-- c@1.9.9 During the installation process, the c@1.0.3 dependency for b was placed in the root of the tree. Though d's dependency on c@1.x could have been satisfied by c@1.0.3, the newer c@1.9.0 dependency was used, because npm favors updates by default, even when doing so causes duplication. Running npm dedupe will cause npm to note the duplication and re-evaluate, deleting the nested c module, because the one in the root is sufficient. To prefer deduplication over novelty during the installation process, run npm install --prefer-dedupe or npm config set prefer-dedupe true. Arguments are ignored. Dedupe always acts on the entire tree. Note that this operation transforms the dependency tree, but will never result in new modules being installed. Using npm find-dupes will run the command in --dry-run mode. Note: npm dedupe will never update the semver values of direct dependencies in your project package.json, if you want to update values in package.json you can run: npm update --save instead.During the installation process, the c@1.0.3 dependency for b was placed in the root of the tree. Though d's dependency on c@1.x could have been satisfied by c@1.0.3

04

尝试 React 17 RC / Demo of Gradual React Upgrades

前一段时间,React团队发布了 React 17 RC [1],对于这个版本,官方说的是没有新特性,可以称作是一个 “垫脚石” 版本,为以后的版本更新做准备。主要是因为之前的 “all-or-nothing” 升级策略遇到了问题:一方面React团队要一直维护老旧的并且使用较少的API;一方面开发者在面对React版本升级时,往往需要升级整个项目,这意味较高的风险,特别对于很老旧的项目(哈哈,估计到时候很多人都会吐槽~)。所以提供了一个 渐进升级 的方案,那 React 17 就是使得 渐进升级 变得更加容易!为此还更改了 React 的事件代理模式。这篇文章是对官方提供的 渐进升级 的例子 Demo of Gradual React Upgrades [2],表述一下自己认为它是如何工作的。

03
领券