<Aaron />

How to Check Your Project for Unused Dependencies

Jan 16, 2020 1 min read

The npm package depcheck is a great way to analyze your project to identify for unused dependencies. It will also identify any useless dependencies or any dependencies that are missing from the package.json file.

To install (globally):

1npm i -g depcheck

Run with depcheck inside the root directory of your project.

Depcheck also takes a handful of optional arguments that can be found on the npm page linked above.

Use this package with a grain of salt. It is a great way to clean up after a big refactor but it may generate some false positives for certain kinds of projects. For example, I used this on Gatsby site and the majority of the gatsby plugins were flagged as unused even though they are used at build time.

Find a mistake? Help me fix it by submitting a pull request.

← back to all posts