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?
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?
--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)
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”
}
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