Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
NPM Dependency types

NPM dependency types comparison

Compiled a list of differences between different types of dependencies supported by NPM. If you are someone like who doesn't change package.json often but needs something for a quick reference then the below table might be helpful.

Dimension Direct Dev Peer Optional Bundled
Popular use-case Using lodash functions on your page Using webpack to build your app Building libraries and plugins. react-dom could be a peer dependency for react Using packages which only work on certain platforms for e.g. fb-watchman which doesn't work on windows (till now) When you want to ship a package/module along with your npm-package and the package/module is not on the npm registry
Required in production Yes No Yes Yes if available Yes
Required during development Yes Yes Yes Yes if available Yes
Name dependencies devDependencies peerDependencies optionalDependencies bundledDependencies or bundleDepencies
Specified as Object Object Object Object Array
Command npm install <package-name@version> npm install <package-name@version> --save-dev NA npm install <package-name@version> --save-optional NA


<package-name@version> can also be a git url or a folder on disk. For more information, refer to npm install --help.

For detailed reading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment