D
D
Dmitry Gorbach2016-06-06 11:26:18
JavaScript
Dmitry Gorbach, 2016-06-06 11:26:18

Can RequireJs be used to dynamically include modules?

Good afternoon. I did not find any material in the Internet, In general, I write SPA. and a question arose.
There is a kernel and there are modules, there can be more than 200 of them. Assembly into one file is no longer needed, a different number of modules will be available for different users.
For example, I see it like this:
1. Initially, require connects global scripts, libraries.
2. Next, draw a menu for selecting modules.
3. When switching to a module, require pulls up all the necessary dependencies, and the module is loaded.
4. When switching to another module, merge all dependencies from the previous module and load new ones.
How bad / good is this approach, and is there already a similar implementation? Are there alternatives besides using builders (gulp, grunt)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2016-06-06
@0whitewolf0

Webpack definitely does this. In general, google according to bundle arithmetics. Not sure if r.js can do this.

Are there alternatives besides using builders (gulp, grunt)?
Are there any reasons to refuse task runners, besides laziness and religion?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question