DEV Community

loading...
Cover image for Remove unused npm modules in less than 30 seconds!

Remove unused npm modules in less than 30 seconds!

manitej profile image Manitej ⚡ ・1 min read

In this quick tutorial, I'll tell you how you can find the unused npm modules in your project and remove them.

Go to the project's root folder and run the below command,

npx depcheck
Enter fullscreen mode Exit fullscreen mode

It will display all the unused packages in your project.

To uninstall a module simply run the below command

npm uninstall <package>
Enter fullscreen mode Exit fullscreen mode

or

yarn remove <package>
Enter fullscreen mode Exit fullscreen mode

Discussion

pic
Editor guide