-
Notifications
You must be signed in to change notification settings - Fork 15
The loader extension config
The loader extension config is specified on the client using the combo property of the require AMD loader config as illustrated in the following example.
require = { paths: { // define module paths }, packages: { // define module packages }, combo: { contextPath: "testaggr", expandRequire: true, extraArgs: { foo: "bar" } } };
The AMD loader config, along with the loader extension config (the combo property), must be specified before the Aggregator provided loader extension JavaScript and the AMD loader are loaded. A number of config properties are honored only when the Aggregator is running in development mode. These are identified in the table below. See Options for information on how to run the Aggregator in development mode. The loader extension config may specify the following properties. Note: properties that take a boolean value will recognize any of true
, 1
, "true"
or "1"
as being true.
Property | Description |
---|---|
contextPath | The URL path of the Aggregator service. This is typically the value of the alias attribute in the <servelt> element defining the Aggregator servlet) in plugin.xml, but it may also be a page relative URL. This property is required. |
expandRequire |
If true, then the Aggregator will perform require list expansion. If the value of this property is the string "log", then the Aggregator will perform require list expansion with logging to the browser console (using console.log()) of detailed information about the expansion. This information is useful in analyzing why a particular module is included, or not included, in an expanded require list. This property maps directly to the Note that this property and |
serverExpandLayers |
If true, then the Aggregator will perform server-side layer expansion. Note that this property and
This property is new in version 1.2.2. |
optimize |
One of simple , whitespace or none . Specifies the level of optimization performed on the requested modules. The default value is simple . This property maps directly to the optimize URL query arg for the Aggregator servlet.
Development mode or debug mode must be enabled for this option to be recognized.
With versions of the Aggregator prior to 1.2, setting the value of this property to "none" has the side-effect of disabling module name exporting (see the |
cacheBust |
An arbitrary string specified by the application that will be included as the value of the cb URL query argument in all Aggregator requests. Note that the cb query arg is not recognized by the aggregator. The argument is provide simply for the purpose of busting the cache. |
exportNames (Pre-1.2 only) |
If true, then the Aggregator will export module names in the define() functions of anonymous modules. In general, AMD modules should be anonymous to make them portable, but some loaders may require that module names be provided in Aggregated builds, and module names must be provided for modules that are loaded using the same request that loads the loader. Anonymous modules do not declare the module name in the define() function. For example, the following defines an anonymous module:
define([ "dojo/connect", "dojo/query" ], function(connect, query) { . . . });When a module is requested and this option is specified, the name used to request the module is inserted into the define function as the first parameter, so if the module containing the example above is requested as js/moduleA, then the define function will be rewritten by the Aggregator as follows: define("js/moduleA", [ "dojo/connect", "dojo/query" ], function(connect, query) { . . . });This option does not work when optimize=none is specified because the functionality is implemented by a custom compiler pass and the compiler is not used when optimization is disabled.
This option maps directly to the This option is only available on versions of the Aggregator prior to 1.2. In 1.2, and above, module names are always exported and there is no restriction with regard to module name exporting and optimization level. |
extraArgs | Aggregator extensions may support additional query args in Aggregator URLs. This property provides a mechanism for applications to specify name/value pairs for arbitrary query args. The value is an object who's property names and values are mapped directly to URL query arg names and values for all Aggregator requests. |
featureFilter |
Optionally specifies a JavaScript function that accepts a feature name and returns true if the feature name and value should be sent to the server or false if it should be filtered out. Filtered features will be undefined on the server when processing requests. Code trimming using has.js feature detection will not take place for undefined features, and undefined features in has! loader plugin expressions will result in has! loader plugin branching when using require list expansion or incomplete dependency expansion when using server-side layer expansion. This property can be useful for weeding out those features that don't significantly impact code size or dependency expansion, thereby reducing the possible number of request permutations and increasing cache-hit ratios. |
showFilenames |
If true, then a line-feed plus a javascript comment string containing the name and location of the resource on the server will be included before the contents of each aggregated module in the response. The default value is false. This option maps directly to the showFilenames URL query arg for the Aggregator servlet.
Note that this option only affects loader generated requests when require list expansion is enabled. It is not supported when using server-side layer expansion, or for application generated bootstrap layers. If you are using this feature and wish to have i18n resources omitted from the application generated bootstrap layer, then you can omit the name of the i18n loader plugin in the This property was introduced in version 1.2.2 |
isSupportedModule |
A function that takes a single, module id, parameter and returns true if the specified module id can be loaded by the Aggregator. The default implementation returns false for absolute and server relative URLs and true for all other inputs. If you wish to bypass the Aggregator for certain modules, provide an implementation of this function that returns false for those modules ids and the loader will load those modules individually as if the Aggregator was not in use. |
sourcemaps |
If true, then source maps will be generated for minified JavaScript code and will be made available to browser clients that support source maps. The This property maps directly to the |