Do you put Babel and Webpack in devDependencies or Dependencies? Do you put Babel and Webpack in devDependencies or Dependencies? javascript javascript

Do you put Babel and Webpack in devDependencies or Dependencies?


The babel and webpack packages will go into the devDependencies section because these packages are used in when transpiling and bundle-ing your code into vanilla javascript in the bundle.js & etc file(s).

In production you will run your code off the bundle.js build/generated code will not require these dependencies anymore.


Despite what basically everyone says, I'm going to offer a piece of sanity... it's really quite simple:

Is your project going to be npm installed by another project? a.k.a are you authoring a npm module? will it end up in another projects package.json?

No?

Then put everything in dependencies.

Yes?

  • dependencies: Things you want downstream consumers and project developers of your project to have installed:
  • peerDependencies: Things your downstream users need to make sure they have installed
  • bundleDependencies: Things your downstream users will need, and won't need to install separately because when you npm publish, these will be "bundled" with your package.
  • optionalDependencies: Things that are nice to have but the absence of will not cause fatal error
  • devDependencies: things only used while working on your project.

The short of it is this: modules do not magically get installed differently. They either get installed or they do not.


Dev dependency is which only use for the development server, these are devDepedency:All the packages which are not using in source code or imported are devDependencies

"babel-cli": "^6.26.0","babel-core": "^6.26.0","babel-loader": "^7.1.4","babel-preset-env": "^1.6.1","babel-preset-react": "^6.24.1","clean-webpack-plugin": "^0.1.19","copy-webpack-plugin": "^4.5.1","css-loader": "^0.28.11","file-loader": "^1.1.11","html-webpack-plugin": "^3.2.0","mini-css-extract-plugin": "^0.4.0","node-sass": "^4.8.3","optimize-css-assets-webpack-plugin": "^4.0.0","prop-types": "^15.6.1","sass-loader": "^7.0.1","style-loader": "^0.21.0","uglifyjs-webpack-plugin": "^1.2.5","webpack": "^4.6.0","webpack-cli": "^3.1.1","webpack-dev-server": "^3.1.9"