Newbies-Tip: Finding unused node package dependencies

Newbies-Tip: Finding unused node package dependencies

While working on a web project we try a lot of packages at times. Few works as we want and few don't. Remembering to uninstall unused dependency to keep the environment clean becomes a boring task (at least for me).

Depcheck comes to the rescue. Usage is very straightforward.

Install depcheck

npm i -g depcheck

Check unused dependencies

Go to your project directory where your package.json is located, and execute depcheck using npx:

cd project_directory
npx depcheck

All unused dependencies and devDependencies will be shown on console.

e.g.

Screenshot 2021-04-10 at 6.42.47 AM.png

And yes, it works with TypeScript as well.

Now we can concentrate on hacking the project and can perform a depcheck at our ease our right before a commit.

Happy Coding!!!