I feel that this question can really see a lot of fish in troubled waters, including before me… Don’t know we can learn, not shameful, but some articles are really wrong

I think most people’s intuitive understanding is that what is used in packaging is called production, and what is not used is called development. I think this boundary is questionable

I understand it, can’t type packaging and dependencies, devDependencies has nothing to do, need packaging is certainly did you write the code references, packaging tools have their own judgment, I haven’t heard of what packaging tools by introducing judgment direct the whole quantity not packing, so need commjs, doing the esm.

The difference between

The dependencies of devDependencies are not automatically added to packagejson when you install an external module. The function of this module does not depend on devDependencies. Production = devDependencies = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production = production

If you just use NPM Install, it doesn’t matter which directory you put it in. It’s up to the packaging tool. When you think about it, NPM is just a dependency management tool, so how can it decide whether a project package is needed or not?

counter

If you want to add webpack dependencies to your production environment, add Webpack to your production environment and add webpack to your production environment.

Think about it, NPM’s own things must be for the convenience of dealing with dependencies, packaging is done downstream.

Packaging by dependency type is understandable, but packaging by dependency type is inappropriate.

conclusion

Eslint, prettier, ts type, and so on can be added to devDependencies NPM install — Production can be used to reduce the dependent installation time. The precondition must be not involved in packaging. However, most people don’t use this command, so it’s okay to install both dependencies anyway.

If you want to add a new module to the NPM repository, add it to devDependencies. If you want to add a new module to the repository, add it to devDependencies. For example, webpack and Babel dependencies introduced into the module may not be necessary for the introducing party.

Say some disorderly, welcome big boss criticism and correction

[1] NPM install – SegmentFault no)