I got some free time and decided to see what a nodejs project is and how hard/easy it is to work with it compared to PHP. The following question immediately arose:
When I deploy a project through Docker, the size of the project folder on the computer is adequate (about 6 megabytes for a simple Hello World). If when creating a project I choose custom hosting or hosting on Heroku, then it will be necessary to install indecently many nodejs modules. Because of this, the project folder on your computer will take up 163 megabytes for a simple Hello World, the total number of installed modules will be 508…
Q: is this normal for nodejs projects? If so, do I understand correctly that these modules are necessary for the normal operation of the node server, and in the case of Docker, all the necessary environment is located in the container itself and therefore there is no need to install all these modules, and therefore the project folder takes up only 6 megabytes?
hello @Mr.Rubi,
Some node modules are used within the components provided by wappler and some modules are waiting for future components. (example: socket.io) … so this is normal.
I thought so, but I wanted to clarify. It looks like we'll have to put up with it, although I think it's extremely wasteful. While I was checking various settings, I created 10 Hello World projects (sites with one line of text) that take up more than 1.6 gigabytes on the computer... It seems that just recently 50 megabytes was considered an incredibly large HDD We all become wasteful...
Yes, the entire node_modules folder is not loaded, but quite a large part of the modules are still uploaded to the hosting. If you create a new project and deploy it on Heroku, you will see this in the app settings on the hosting:
I assume 90% of these 63 megabytes are modules necessary for stable operation of node.
Currently for example we install all the database drivers for MySQL, Microsoft SQL, Postgres and SQLite and those are huge packages while you usually use just one. So we hope to improve that soon and make it much smarter.
In my case some modules are required indeed. Got error Cannot find module 'universalify' and stuff... that are required from node_modules... writing while waiting them being transferred to the server