Show TOC

Why not Simply Concatenating Modules?Locate this document in the navigation structure

Using the runtime behavior of the merged file is more predictable that concatenating multiple modules. By using the dependency resolution tool, however, concatenating is possible considering some important points.

Multiple modules can not simply be concatenated into a bigger module, but have to be parsed and nested according to the original jQuery.sap.require calls to make the runtime behavior of the merged files more predictable. For modules with complex or cyclic dependencies, the order of module execution is important. The jQuery.sap.require function ensures that the caller only continues after the required module has been successfully loaded and executed. And this is only possible if the required module is embedded exactly at the place where the jQuery.sap.require call was located.

However, if the use of the dependency resolution tool is not possible, concatenating the modules is possible if the developer ensures the following:

  • File order according to the dependencies: A module must not 'require' another module that is merged later.

  • Merged modules must declare by using the jQuery.sap.declare function; this ensures that SAPUI5 knows that the modules have been loaded and thus does not load them again.