问题描述
npm 允许我们指定 bundledDependencies
,但是这样做有什么好处呢?我想如果我们想确保我们得到正确的版本,即使我们引用的模块被删除,或者捆绑可能有速度优势?
npm allows us to specify bundledDependencies
, but what are the advantages of doing so? I guess if we want to make absolutely sure we get the right version even if the module we reference gets deleted, or perhaps there is a speed benefit with bundling?
有人知道 bundledDependencies
相对于普通依赖的优势吗?
Anyone know the advantages of bundledDependencies
over normal dependencies?
推荐答案
Node 目前最大的问题之一是它的变化速度有多快.这意味着生产系统可能非常脆弱,npm update
很容易破坏.
One of the biggest problems right now with Node is how fast it is changing. This means that production systems can be very fragile and an npm update
can easily break things.
使用 bundledDependencies 是解决此问题的一种方法,通过确保,正如您正确推测的那样,无论其他情况发生什么变化,您将始终提供正确的依赖项.
Using bundledDependencies is a way to get round this issue by ensuring, as you correctly surmise, that you will always deliver the correct dependencies no matter what else may be changing.
您还可以使用它来捆绑您自己的私有捆绑包并随安装一起交付.
You can also use this to bundle up your own, private bundles and deliver them with the install.
这篇关于bundledDependencies 相对于 npm 中的普通依赖项的优势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!