Answer the question
In order to leave comments, you need to log in
What are the modern approaches to organizing a web application with a large code base?
Considering various options for a future project; I ask you to suggest what solutions, approaches, technologies exist at the moment.
Suppose an application is being developed with a large (>> 1Mb) JS code base. There are several entry points to this code. This means that some pages of the site or some web applications of this project will load one set of modules, others - another set. At the same time, each of these sites/pages/web applications can potentially request any module as needed (substantially depends on user actions).
It will not work to make one assembly, because the access time will be unreasonably high. Add to this that we assume that the user may not have a high-speed connection, not visit the site before, and so on.
As I see it, the only solution is to use asynchronous module loading.
On the other hand, programmers should be able to write their (loosely coupled) modules as if all the code was downloaded to the client machine, or as if it were executed on the server.
In other words, we are looking for a tool that would allow us to abstract from the problem of asynchronous loading of the minimum required set of modules described above.
Question number 1. Is RequireJS/AMD sufficient for the task at hand.
Answer the question
In order to leave comments, you need to log in
requirejs can only be used in amd, that is, with commonjs modules (and in npm the vast majority are), and even more so with es6, nothing will work. In general, it makes no sense to take it now.
webpack + code splitting is the answer to your question.
Why is standard webpack bad? he can both make separate files for entry points and allocate repeating modules to a common file, and with the ability to set criteria for how often they should be repeated.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question