Skip to main content

What are dev dependencies and how do they differ from regular dependencies?

Dev dependencies (devDependencies) are packages needed only during development, not required for the application to run in production.

Regular dependencies (dependencies) are packages the application needs at runtime, that is, directly while it is running.


The core difference

TypeWhere it's usedExamples
dependencieswhile the application runsreact, axios, express
devDependenciesonly during development and buildwebpack, eslint, jest, babel

The practical difference

  1. Regular dependencies are installed on the production server too, because the application won't start without them.
  2. Dev dependencies are usually not installed in production, in order to:
  • shrink the size of the environment,
  • speed up deployment,
  • leave out extra tools that aren't needed there.

How they are installed

  • A regular dependency:

    bash
    npm install react
  • A dev dependency:

    bash
    npm install webpack --save-dev

In short: dependencies is what the application needs to run. devDependencies is what only the developer needs during development and build.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.