What exactly is the node_modules folder and what is it for?
I know when we download any library with npm
, the library goes to folder node_modules. I also know that, when we are going to upload it (to GitHub, for example) we have to ignore the node_modules folder, because it takes a lot of space. Through file package.json we can download all dependencies using npm i
.
Let's say I want to deploy my app/website to some server/host, do I have to upload the node_modules
folder to server as well?
And another thing. Usually, I download my jQuery and Bootstrap files from the website and copy in the content to the css/js folder inside my project, but this time I tried with npm and everything goes to folder node_modules and I'm using Cordova. When I execute the command cordova build
, neither my jQuery nor my Bootstrap files are generated.
So those are my questions:
- if I want to host my project, do I really have to upload the node_modules folder as well?
- And when it's Cordova or Ionic, do I also have to copy the node_modules folder to the www folder?
- If so, what is the point of using npm to download libraries? Is this how it's really done? Which one is better? Going to the website, download the file, and paste inside www, or download through npm?