Answer the question
In order to leave comments, you need to log in
Node.js, what's the best way to deal with modules in production?
For the frontend, it is practiced to combine several files into one, different compression, etc. How about this in the case of server-side node.js projects?
Answer the question
In order to leave comments, you need to log in
Concatenation and so on are needed to reduce the number of HTTP requests and the associated blocking, delays and other fun.
On the server, this is not necessary. The script is loaded into memory and stays there until you kill the server. Further JIT will optimize everything further.
The only thing that can happen is if the modules are requested where they are needed, and not when the module is initialized. In this case, due to the synchronous operation of CommonJS, there may be problems if the module has not yet been loaded by anyone. But certainly concatenation will not help the case.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question