Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 25, 2021 01:11 am GMT

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 application
  • devDependencies: 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:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To