liveBook · Manning

Development dependency

As explained in Essential TypeScript 5, Third Edition

devDependencies is the package.json field that records packages required during project development rather than at application runtime.

A development dependency is a package recorded in package.json for project tooling rather than application runtime. Install it with --save-dev; runtime packages belong in dependencies. Local installation also lets other packages in the project use the tool. section 5.3

{
 "name": "tools",
 "version": "1.0.0",
 "description": "",
 "main": "index.js",
 "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1"
 },
 "keywords": [],
 "author": "",
 "license": "ISC",
 "devDependencies": {
   "tsc-watch": "^6.0.0",
   "typescript": "^5.0.2"
 }
}

A package.json example records tsc-watch and typescript under devDependencies, with version ranges such as ^6.0.0 and ^5.0.2. section 5.3

Use the NPM commands that match the package's role:

  • Run npm install --save-dev package@version to install a specific local development package and add it to devDependencies. section 5.3
  • Run npm install package@version for a package added to dependencies rather than devDependencies. section 5.3
  • Run npm install to perform a local install from package.json. section 5.3

Container deployment configuration

A deploy-package.json file can place express, json-server, and connect-history-api-fallback under devDependencies when the application imports have already been incorporated into a webpack bundle and the packages are needed to run the container. section 19.4.1 section 21.5.1

How Essential TypeScript 5, Third Edition covers it

How deep it goes
Explains package classification, local installation, version ranges, and commands, but does not detail NPM's dependency-resolution algorithm.
Examples
Uses tsc-watch and typescript listings plus Angular and React container configurations with Express-related packages.
What it assumes
Assumes familiarity with NPM and package.json while distinguishing local from global packages and development from application dependencies.
What you can do after
Operate/configure NPM projects by classifying packages and installing local development tools with --save-dev.
How it connects
Connects package.json, dependencies, local installation, global installation, NPM, TypeScript compiler, and webpack bundles.

Also explained in

Compare how 4 books explain development dependency →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Essential TypeScript 5, Third Edition. The section links point to the parts of the book it draws on.