What is the difference between "dependencies" and "devDependencies"?

5

What's the difference between saving a component like dependencies or devDependencies in bower , npm , composer and others that use this structure?

    
asked by anonymous 07.11.2016 / 00:51

1 answer

6

TL; DR:

  • dependencies : programs required for production

  • devDependencies : programs used for development

When we run npm install on a directory where there is a repository and package.json both dependencies and devDependencies are installed.  When we run install with a specific package: npm instal pacote only dependencias (production) are installed, to install both uses the -dev flag: npm instal pacote -dev

dependencies

dependencies are all programs required for the application to work. The application depends on them and must be installed otherwise the application does not run. If you want to install only the production dependencies you can use npm install --production .

To write a dependency as essential:

npm install pacote --save

dependencies

dependencies are all programs required for "dev" environment, development, of the application. It can be anything from code compressors, transpilators, unit tests, debugging tools, etc. These are not required for the application to work, but rather to develop and / or test.

To write a dependency as "dev":

npm install pacote --save-dev
    
07.11.2016 / 07:43