This article is a mirror article of machine translation, please click here to jump to the original article.

View: 6238|Reply: 0

No more entanglement between devDependencies and dependencies

[Copy link]
Posted on 10/9/2018 2:32:38 PM | | |
Previously struggled with the issue of package dependency management for an npm installation. That is true:

When we use npm install to install modules or plugins, there are two commands to write them into the package.json file, they are:

--save-dev

or

--save

First of all, it should be noted that the Chinese meaning of the word Dependencies means dependency and dependency, while dev is

Short for develop.

Therefore, the difference between them is reflected in the package.json file, which is that plugins installed using --save-dev are written to the devDependencies domain, while plugins installed using --save are written to the dependencies block.

So what's the difference between devDependencies and dependencies objects in package.json files?

The plugins in devDependencies are only used in the development environment, not in the production environment, and dependencies need to be released to the production environment.

For example, if we write a project that depends on jQuery, an error will be reported if the dependency runs without this package, so we will write this dependency to dependencies.

And some of the build tools we use, such as glup and webpack, are just packages used in development, and they are online

It has nothing to do with them, so write it to devDependencies.






Previous:Fancy ornaments and tea trays carved from copper and aluminum are of artistic significance
Next:npm upgrades all dependencies
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com