I am a beginner (~15 days into learning web-development) and I am currently learning React among other things and I am sorry if this sounds too trivial.
I am trying to understand the difference between devDependencies and dependencies and the correct usage of the same.
I have tried to figure it out from the docs and stackoverflow questions but I am not a 100% sure if I have this right. So kindly review my understanding as of now and let me know if I have this right so far.
Definition
dependencies: only the packages which are finally going to be used by the production build. These will be there in the final package.json file.
devDepndencies: the packages which eases my development efforts and finally will not be used by the product / application. These will not be included in the package.json folder of the final build.
Importance of correct usage
Fairly important as correctly excluding devDependencies from dependencies can make the app lighter. At the same time, incorrectly excluding required dependencies will cause my app to break.
Practical example
In the package.json file created during my tutorial, I had the following packages and I am mentioning the type of dependency that the package should have according to my current understanding. Please let me know if I am erring somewhere:
- babel-cli : devDependency
- babel-core: devDependency
- babel-loader: devDependency
- babel-plugin-transform-class-properties: devDependency
- babel-preset-env: devDependency
- babel-preset-react: devDependency
- css-loader: devDependency
- node-sass: dependency
- react: dependency
- react-dom: dependency
- react-modal: dependency
- sass-loader: dependency
- style-loader: dependency
- validator: dependency
- webpack: dev-dependency
- webpack-dev-server: dev-dependency
Please let me know if I have any of these wrong