NodeJS because so many files

4

Good afternoon guys,

I'm just getting started with NodeJS a project in VUEJS, and I saw that when I give the command

NPM INSTALL

It creates about 20,000 files, my application comes with 100mb with almost no dependency ...

What is the purpose of such a folder and file?

    
asked by anonymous 18.09.2017 / 22:09

1 answer

3

The packages you install with npm install are required programs for the dependencies you mentioned in packacge.json . They are there because they are accurate in some part of programs / packages that you will use.

For example, webpack alone has 22 dependencies , and is an essential piece of code for compiling.

You can always remove packages that you no longer need, but you have to start, to have the features you need and the code can be packaged and go (as light as possible) to the client, then you need those dependencies.

These programs go to the node_modules folder that you should ignore with a line in .gitignore because you should not "commit" those folders or copy them. If you take into account that each package has its dependencies, which have their dependencies ... it is a very vicious circle. Hence 100mb in that case.

Try to keep only the packages you need, but of course, there is npm a lot of useful and interesting ... it is easier to accumulate than to clean.

    
18.09.2017 / 22:24