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

Asked

Viewed 3,675 times

12

What’s the difference between saving a component like "dependencies" or "devDependencies" in the Bower, npm, commiserate among others using this structure ?

  • 1

    The best answer ever given to that question. http://stackoverflow.com/questions/18875674/whats-the-difference-between-dependencies-devdependencies-and-peerdependencies (In English)

1 answer

12


TL;DR:

  • dependencies: programs needed for production

  • devDependencies: programs used for development

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


dependencies

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

To record a dependency as essential:

npm install pacote --save

devDependencies

devDependencies are all programs required for "dev" environment, development, application environment. It can be everything from code compressors, transpillators, unit tests, debug tools, etc. These are not necessary for the application to work, but rather to develop and/or test.

To record a dependency as "dev":

npm install pacote --save-dev

Browser other questions tagged

You are not signed in. Login or sign up in order to post.