Reputation: 15627
Im going through a tutorial on webpack (third day and still confused as anything!) and Im combing through the commands:
npm i webpack --save-dev
The above command installs the webpack as a node module to '--save-dev'? Im confused what '--save-dev' is. And is it a normal convention for webpacks to use?
Also where is this dependency being saved? I dont find any reference to it in webpack.config.js
or package.json
for that matter?
Many thanks
Upvotes: 1
Views: 618
Reputation: 1862
npm i webpack --save-dev
is a shorthand for npm install webpack --save-dev
. The --save-dev
flag tells npm
to save the dependency as a development dependency, i.e. it will be listed in devDependencies
in package.json
instead of the "normal" dependencies
section.
What this means is that development dependencies are dependencies that are not required to run your application, but only for development purposes like running unit tests, bundling the application, etc. etc.
From the documentation for npm install:
-D, --save-dev: Package will appear in your devDependencies.
Here is another stackoverflow post on differences between "normal" dependencies and development dependencies.
Cheers, Alex
Upvotes: 2