The problem of webpack packaging

when I am using webpack recently, I have a question, that is, when I install dependencies,
if I use npm install-- save webpack, will show the newly installed dependencies in the dependencies in package.json. This is the dependencies just installed in the production environment
if I use npm install-- save-dev webpack, will show the newly installed dependencies in the devDependencies in package.json. This is the dependencies needed by the development environment
but if I use npm install webpack, There is nothing in package.json. Where is my installed dependency, the build environment or the development environment? Why not show it in package.json?
another: if a dependency is required by the production environment and also by local developers, should the two be installed separately, or how?

Apr.09,2021

after you feel that your understanding of, npm install is wrong, it will be installed to node_modules with or without-- save or-- save-dev,.

  1. when you run npm install to initialize the project, both dependencies and devDependencies modules are downloaded to the project directory.
  2. when running npm install-- production or indicating that the value of the NODE_ENV variable is production, the package of-- save-dev (devDependencies) will not automatically download the module to the node_modules directory, but the package corresponding to-- save (dependencies) will
  3. in essence, devDependencies is development-assisted scaffolding and does not participate in the formal running of the code, such as autoprefixer,gulp. After the code is packaged, the online code is not needed, but similar to libraries such as vue,axios, the online code depends on these libraries to execute, so you need to put it into dependencies.
  4. for the packages needed by the project, either dependencies or devDependencies, should be added to package.json, because another colleague gets your code, and if he wants to run it, he has to install the corresponding package first, and all the required packages are recorded in package.json
  5. .

the dependencies you install are always in node_modules, and package.json just records what dependencies your project has. If dependencies are needed in the production environment and by local developers, you'd better record them in dependencies to ensure that users' interests come first. Whether you record it in dependencies or devDependencies, these dependencies will be downloaded to node_modules when you execute npm install, and there is no difference in use.


are you sure you are not mistaken-- save is a production dependencies-- save-dev is a developer devDependencies


do you understand the same question at this time?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3260f-2b171.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3260f-2b171.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?