node.jsnpmdependencies

Advantages of bundledDependencies over normal dependencies in npm


npm allows us to specify bundleDependencies, 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?

Anyone know the advantages of bundledDependencies over normal dependencies?


Solution

  • 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.

    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.