Find Unused npm Packages in Your Package.json
JavaScript makes it easy to install packages and dependencies into our apps.
The problem is, after a few days, weeks, or months of hacking, how the heck do we know what isn't even being used anymore?
Find unused packages
It's easy with a neat package called depcheck
.
From your terminal, go into the root folder of your project (wherever your package.json lives) and run the following command:
npx depcheck
Now you'll see the output showing two sections, your "unused depencies", and "unused devDependencies".
Now, uninstall those suckers!!!
Although it's usually great, I've noticed occasionally depcheck gets it wrong, so make sure you confirm that you aren't using those packages before you drop the dynamite. 💣
Follow me on Twitter or connect on LinkedIn.
🚨 Want to make friends and learn from peers? You can join our free web developer community here. 🎉