Wiki source code of JavaScript Importmap API

Last modified by Manuel Leduc on 2026/05/11 18:00

Hide last authors
Manuel Leduc 1.1 1 The importmap extension scans forĀ ##xwiki.extension.javascript.modules.importmap## properties in installed extensions.
2
3 The content of the property is expected to be an object with:
4
5 * Keys corresponding to the IDs of JavaScript modules imported in the JavaScript bundled in the extension
6 * Values corresponding to the webjars reference to the module to resolve when the key is used for an import in the browser
7
8 The webjars reference is composed of ##${groupId}:${packageId}/${pathInwebjar.js}##.
9
10 The reference is checked at build time, and the build fails if the reference is not correctly resolved.
Manuel Leduc 5.1 11
12 {{version since="18.1.0RC1"}}
13 Transitive dependencies can be used in the values of the importmap.
14 {{/version}}
Manuel Leduc 6.1 15
16 {{version since="18.4.0RC1"}}
17 == Eager ==
18
19 A module is eager when it is loaded directly during page load (i.e., not when another module explicitly imports it).
20
21 A module is eager when its webjar reference starts with a ##!##.
22
23 == Anonymous ==
24
25 A module is anonymous when it does not need to be imported by other modules.
26 In other words, it is not included in the importmap definition.
27 Not that it is not advised to make a non-eager module anonymous as it wouldn't be declared anywhere (i.e. the declaration would be dead code).
28
29 A module is anonymous when its key starts with a ##_##.
30 {{/version}}

Get Connected