What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?

前端 未结 14 1752
灰色年华
灰色年华 2020-11-22 00:43

This documentation answers my question very poorly. I didn\'t understand those explanations. Can someone say in simpler words? Maybe with examples if it\'s hard to choose si

相关标签:
14条回答
  • 2020-11-22 01:45

    There are some modules and packages only necessary for development, which are not needed in production. Like it says it in the documentation:

    If someone is planning on downloading and using your module in their program, then they probably don't want or need to download and build the external test or documentation framework that you use. In this case, it's best to list these additional items in a devDependencies hash.

    0 讨论(0)
  • 2020-11-22 01:45

    In short

    1. Dependencies - npm install <package> --save-prod installs packages required by your application in production environment.

    2. DevDependencies - npm install <package> --save-dev installs packages required only for local development and testing

    3. Just typing npm install installs all packages mentioned in the package.json

    so if you are working on your local computer just type npm install and continue :)

    0 讨论(0)
提交回复
热议问题