Now you can focus on the logical definition of modules, for example, a self-executing function and an XML descriptor. When those modules are loaded by the browser, GateIn serves them as web resources. By default, a module will be served as a single resource, however this can be an issue in the production system and the load group feature allows decoupling the logical module and the JavaScript resource serving:
The granularity of the module system should have a small impact on the performance, specially when there are many small modules.
The front-end performance should have a small impact on the JavaScript modularity.
The
load-group
XML tag can be used to group modules together in the same web resources. When a module of a load-group is
requested, the web resource containing the modules of the load group is loaded, for instance, if you have the
foo
and
bar
modules grouped by
foobar
:
<module>
<name>foo</name>
<load-group>foobar</load-group>
...
</module>
<module>
<name>bar</name>
<load-group>foobar</load-group>
...
</module>
When the
foo
is loaded, the AMD loader will load the
foobar
group instead of only foo
. Consequently, the
bar
module is also available now. If there is any request for
bar
module, no more request is made as it is already loaded.
Do not use the group name that follows by dash and 2 character, for example: forbar-as. This may cause unexpected parsing group name on the server (on GateIn 3.5.0.Final).