Difference between --save-dev and --save

1. When we use npm install xx --save-dev / --save to install modules or plugins, we will write them to the package.json file, so what's the difference?

--save-dev: will be written into the devDependencies object, the plugins in devDependencies are only used in the development environment;

--save: will be written into the dependencies object, the plugins in dependencies are only used in the production environment;

 

2. How to install it in the production environment and how to install it in the development environment?

The packaged project also needs to have dependent projects so that no error will be reported, then this plug-in will be installed in the production environment, eg: jquery plug-in or vue framework;

Plug-ins for the development environment, eg: webpack packaging tool, after uploading the compressed file, there is no need for webpack, that is the development environment.

 

Supplement: pm install will install modules or plugins in dependencies and devDependencies.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325020276&siteId=291194637