Another thing I do is delete the package-lock.json file and create it again.
Why? Sometimes when I uninstall a dependency it is removed from the package.json and from the package-lock.json but its sub-dependencies are not, so at the end in the "node_modules" folder reside these dependencies that I am no longer using.
And deleting the file and creating it again with "npm install" lightens up the "node_modules" folder for me.
In addition, another tip would also be to install only the dependencies that are going to be used.
Hi Leober! I also delete the package-lock.json because of the same reasons you mentioned, though I'm not 100% sure if this is the best way to remove the sub-dependencies or if it is a good practice.
I totally agree on adding only the dependencies that are going to be used! Thanks for your input :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Another thing I do is delete the package-lock.json file and create it again.
Why? Sometimes when I uninstall a dependency it is removed from the package.json and from the package-lock.json but its sub-dependencies are not, so at the end in the "node_modules" folder reside these dependencies that I am no longer using.
And deleting the file and creating it again with "npm install" lightens up the "node_modules" folder for me.
In addition, another tip would also be to install only the dependencies that are going to be used.
Hi Leober! I also delete the package-lock.json because of the same reasons you mentioned, though I'm not 100% sure if this is the best way to remove the sub-dependencies or if it is a good practice.
I totally agree on adding only the dependencies that are going to be used! Thanks for your input :)