When should I use --save vs --save-dev


#1

When should I use

npm install --save 

vs

npm install --save-dev 

when configuring the package.json dependencies especially when it comes to webpack, babel etc?


#2

--save is for packages you want to load in production (and dev) e.g. React, Moment, Semantic UI, Material UI

--save-dev is for packages you want to load in development mode only e.g. linters (eslint), transpilers (babel), build tools (webpack)


#3

Thanks @reoh! Makes sense.


#4

What about babel-loader?

Has:

{
“react”: “^0.14.2”,
“react-dom”: “^0.14.2”,

“babel-loader”: “^5.3.2”
}

webpack.packages.json
{
“react”: “^0.14.3”,
“react-dom”: “^0.14.3”,

“babel-core”: “^6.3.13”,
“babel-loader”: “^6.2.0”,
“babel-preset-react”: “^6.3.13”,
“babel-preset-es2015”: “^6.3.13”
}


#5

It’s a webpack plugin so it goes in --save-dev

Above that section it says webpack.packages.json which is specifically for webpack dependencies