Dev dependencies in npm in JavaScript

There are also libraries that are needed only in the development process as a tool for the programmer's work. Examples of such libraries are Webpack or Gulp tools (we will study them in the future).

Such libraries are also installed via npm. However, they should not be installed into normal dependencies, but into special dependencies for a developer.

To do this, you need to call the installation with the --save-dev flag:

npm install --save-dev webpack

Or in shorter form:

npm install -D webpack

Or even shorter:

npm i -D webpack

As a result, packages installed by such a command will fall into the devDependencies setting:

{ "devDependencies": { "webpack": "^5.74.0" } }

Install the Gulp library:

npm install --save-dev gulp

Examine a package.json file.