The packages you install with npm install
are programs necessary to the dependencies you referred to in packacge.json
. They are there because they are needed in some part of programs/packages that you will use.
For example, the webpack
alone has 22 dependencies, and is an essential part to compile the code to use.
You can always remove packages that you no longer need, but there is starting, to have the features you need and for the code to be packaged and go (as light as possible) to the client/user, then these dependencies are needed.
These programs go to the folder node_modules
that you should ignore with a line on .gitignore
because you should not "commit" those folders or copy them. If you take into account that each package has its dependencies, which have its dependencies... it is a bit of a vicious circle. Hence 100mb in this case.
Try to keep only the packages you need, but of course, there’s npm
many useful and interesting things... it is easier to accumulate than to clean.
I get it, these dependencies are like: A Visual Studio uses its own dependencies to compile projects, but in the case of Nodejs, we can see in the folder all its dependency files, would that be about right? Thank you!
– Jackson
@Exact Jackson. Remember to ignore the folder and subfolders in the
.gitignore
, to avoid having ballast in Github for example.– Sergio
What would Gitignore be? I couldn’t find this folder. Thank you!
– Jackson
@Jackson the
.gitignore
is a file with that name (no extension) I put. It is to tell Github which files to ignore to avoid checking in and sending to Github extra files. Take a look here: https://github.com/github/gitignore/blob/master/Node.gitignore– Sergio
Hmm understood! It was clear. Thank you! :)
– Jackson