Chapter 40. Load Groups

When self-executing functions and XML descriptors are loaded by a browser, they are served as web resources by the portal. By default, a module is served as a single resource, which can cause performance issues in production systems. The load group feature solves these issues by decoupling the logical modules and the JavaScript resource serving.
The <load-group> element can be used to group modules into a single web resource. When a module contained in a load group is requested, the web resource containing all the grouped modules is loaded. For instance, the code below shows configuration of the foo and bar modules grouped into the foobar load group:

Example 40.1. load-group Example


<module>
  <name>foo</name>
  <load-group>foobar</load-group>
  ...
</module>
<module>
  <name>bar</name>
  <load-group>foobar</load-group>
  ...
</module>
When the foo module is requested, the AMD loader will load the whole foobar group. This will cause that the bar module will be loaded as well. On any subsequent request for the bar module, no more load requests will be made as the module will already have been loaded.