September 25, 2021 01:11 am GMT
Original Link: https://dev.to/takuyakikuchi/dependencies-devdependencies-3nog
dependencies? devDependencies?
How to differentiate them
The basic criteria is whether a package is only needed for development or not.
dependencies
: Packages required to execute the applicationdevDependencies
: Packages required for development/testing
Examples
dependencies
- react, react-dom
- next
devDependencies
- eslint
- husky
- prettier
- typescript
- jest
What's good about differentiating them
- A developer can easily distinguish what packages needed for development or production
- When production build, faster installation time, less disk usage=>
$ npm install --production
Commands
Add a package to dependencies
npm$ npm install <package-name>
Short: $ npm i <package-name>
yarn$ yarn add <package-name>
.
Add a package to devDependencies
npm$ npm install <package-name> --save-dev
Short: $ npm i <package-name> -D
yarn$ yarn add <package-name> --dev
Short: $ yarn add <package-name> -D
Reference
EN
JP
Original Link: https://dev.to/takuyakikuchi/dependencies-devdependencies-3nog
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To