How To Remove Unused Dependencies In React?
Answers (1)
Add AnswerFirst, we need to install npm-check in your app using the following command
(Make sure to run cmd as an administrator and also make sure that this folder contains the package.json file, otherwise, this will not work)
npm install -g npm-check
After completion, run the below command
npm-check
this command will check all of your packages and check whether the package is outdated, incorrect, or unused and gives a list
To remove the particular package from your app execute the following command
Example:
npm uninstall react-router
this will remove react-router from your app.
Thank u @Hardik Ghevariya it’s working.