You are browsing the documentation for version 4.1 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (the latest LTS version) of the Oro documentation to get up-to-date information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

JS Modules



Root Node




type: map

This section is used when a desired module name does not match the path to the module. The keys of the map are module names with trailing $ which are mapped to the actual path of the file that contains the module’s source code. Webpack provides the corresponding syntax and description in its documentation (see Webpack Resolve Alias). Aliases can help import certain modules easily using short names.

2    backbone$: npmassets/backbone/backbone
3    oro/block-widget$: oroui/js/widget/block-widget


type: sequence

Introduces a list of modules that should be initialized before application is launched. They can be used to track certain page events with bundle specific handlers, etc.

2    - oroui/js/app/modules/jstree-actions-module
3    - oroui/js/app/modules/layout-module


type: map

Each module that should be configured at runtime (e.g., via twig templates) must be specified in this section where the key of the map is a module name, and the value is an empty object.

2    controllers/page-controller: {}
3    oroui/js/app: {}


type: map

Add a module name to this section to be able to import a module with the name that is determined at runtime.

1import loadModules from 'oroui/js/app/services/load-modules';
3loadModules(moduleName).then(module => module.init());

Insert a module name to this section nested into the subsection with the name of webpack build chunk where modules have to be added.

2    oroui:
3        - jquery
4        - oroui/js/app/components/view-component


A chunk name should either be a new name or already exist in another bundle. It is preferred to group modules that are used together or/and on specific pages for the maximum benefit of the webpack chunk concept.


type: map

The map option allows to substitute a module with the given ID with a different module. Such substitution is working for the given module prefix.

For example, OroUIBundle is delivered with an extended version of the jQuery library. This means that all modules should receive the extended jQuery library from the OroUIBundle. However, since the bundle itself needs the original version of the library to be able to extend it, it must get the original version when requiring it:

2    '*':
3        'jquery': 'oroui/js/jquery-extend'
4    'oroui/js/jquery-extend':
5        'jquery': 'jquery'


* is a special key that matches all module contexts.


type: map

Webpack places each module in its local scope, however, some third party libraries may expect global dependencies (e.g., $ for jQuery). The libraries may also create globals which need to be exported, so they can stop working. To solve this issue, webpack offers a shimming feature. See Webpack Shimming In our shim section, each key of the map is the name of a module to be created. For each module, a map that configures the module must be specified. It can consist of the following keys:

imports (type: sequence)

If the library depends on specific global variables, these dependencies can be listed here. See Webpack Imports Loader for the detail.

exports (type: string)

The name of a JavaScript symbol that is exposed to other parts of the system that use this symbol. See Webpack Exports Loader for the details.

expose (type: sequence)

Specify which local variables have to be exposed globally. See Webpack Expose Loader for the details.

 2    bootstrap-typeahead:
 3        imports:
 4            - jQuery=jquery
 5    jquery:
 6        expose:
 7            - $
 8            - jQuery
 9    jquery.select2:
10        exports: Select2
11        imports:
12            - jQuery=jquery
13    oroui/js/app/services/app-ready-load-modules:
14        expose: loadModules