What is the advantage of using a script loader to concatenate your script files during the build process?

I heard a lot about script loaders like RequireJS. What is the advantage of using a script loader to concatenate source files during the build process?

+5
source share
2 answers

Concatenating the source files during the build process has the advantage that the client needs to make fewer requests, and the overhead of the request is reduced, and the page load time will be reduced, which will speed up its execution, for example. suppose you have 10 javascript files, now the browser should make 10 HTTPrequests, and each request has its own overhead (request and response headers) if you combine these 10 files by 2 or 3, totaling 2 or 3 HTTPthus reducing overhead. also, any client that follows the specification HTTP 1.1does not allow more than two simultaneous connections to the same domain, so you can see why it is important to have fewer connections (requests)

script javascript , , , javascript, , , javascript , ( ). , facebook, javascipt, , , , ,

+3

Script , JavaScript , : , 2 50 , script, , , 50. .

+2

All Articles