Home > Back-end >  Remove all unused Dependencies from react project using single command
Remove all unused Dependencies from react project using single command

Time:03-21

after using depcheck listing all unused dependencies in my react project,It is quite frustrating to remove each and every dependencies manually . Is there any commands to remove them at once ?

CodePudding user response:

You can remove them all by their name in just one command.

npm uninstall package-1 package-2 package-3

So if you have a list of packaged, you're already half way there :)

CodePudding user response:

By using npm depcheck you can find list of all dependencies that are unused. After that simply running npm uninstall you can delete any dependency. Aftert getting list of unused dependencies you can simply delete them

CodePudding user response:

To remove multiple dependencies at once, you can use npm uninstall or yarn remove, depending on your package manager of choice:

npm uninstall react react-dom
# or
yarn remove react react-dom

Pro tip: If you're using a shell such as bash, zsh or fish, you can use brace expansion to shorten this command:

# removes react and react-dom
npm uninstall react{,-dom}
  • Related