npm check for unused dependencies code example
Example 1: identify unused node modules
To run without installing use npx:
npx depcheck
npm install depcheck -g
or
yarn global add depcheck
Example 2: find the unused npm modules
npm-check or depcheck