I am learning to use webpack and generally getting in to the Javascript world, including npm
.
Several answers deal with --save
vs --save-dev
when using npm install
. My understanding is that their use (and updates to package.json
) is actually useful when recreating either a run or a dev environment via npm install <the package being developed or ran>
--save
is used to save packages needed to run the app in node.js, that is on a server--save-dev
is used to save packages needed to develop the app- a bare
npm install <module>
just installs the package, without enabling the possibility to install it somewhere else though the appropriate entry inpackage.json
Therefore, in a webpack context, is --save
ever used? I belive not, because what is created is a JS bundle which is then included in the HTML file, and ran in a browser. In that sense, there is never a need to "save modules needed to run your app".
In the same vein, --save-dev
is useful (again, in a webpack context) at it allows someone to develop elsewhere (in that case both modules in the app (say, moment.js
) and logistical ones (say, gulp
) should be installed with --save-dev
, right?)
Finally, a bare npm install <module>
is also possible (although less useful) is the development is not intended to be done elsewhere (the modules are still installed but no mention of this fact is made in package.json
).
Is this correct? Specifically, is the assumption of a lack of --save
in a webpack context true?