dependencies
vs devDependencies
Dependencies
Dependencies
that your project needs to run, like a library that provides functions that you call from your code.
dependencies
are installed on both:
package.json
npm i $package
on any other directorydevDependencies
Dependencies you only need during development or releasing, like compilers that take your code and compile it into javascript, test frameworks or documentation generators.
devDependencies
are installed on:
package.json
(unless given --production
flag)
NODE_ENV=production
environment variable is setnpm install $package
on any other directorytransitively
From end user perspective, you normally don't want the development dependencies, so you just get what is needed to use the package (dependencies
, not devDependencies
).
If you want to develop, you would need additional packages needed for dependencies like tests.
transitive
dependencies
are installed transitively
A
requires B
, and B
requires C
, then C
gets installed, otherwise B
could not work, and neither would A
.devDependencies
are not installed transitively.
B
to test A
, so B
's testing dependencies can be left out.