What is the use of dependencies in package.json in npm?

npm install-- save-dev will be saved to devDependencies, npm install-- save will be saved to dependencies.

I used the vue-video plug-in in the project, only saved it in devDependencies, and the plug-in works fine after packaging. But it is not stored in dependencies, why will the plug-in not report an error? Isn"t it a runtime dependency?

Mar.03,2021

there will be no problem with this dependencies as the front end, because the final code is packaged into the release file.

it's obvious when writing nodejs applications. Nodejs is not packaged, and all the external modules needed are in the node_modules directory.

there are two ways to install nodejs dependencies, one is to install all npm install , and the other is to install npm install in production environment-- production

  1. both modes in dependencies are installed
  2. devDependencies production mode will not be installed

so the production environment uses the -- production parameter to ensure that only the packages necessary to run the application are downloaded.

for example, if we use eslint when developing, then we need to put this into devDependencies , because the existence of this package does not affect the execution of the server code, but only restricts the code style when developing.

Menu