RequireJS Module Config

Last modified by Vincent Massol on 2021/07/22

Publishes a RequireJS module

Usage

This extension point can be used to publish a RequireJS module to the global RequireJS configuration, allowing others to use the module without specifying its path.

Definition

This Extension Point is contributed by this extension and was added in version 12.3-rc-1 of that extension.

Category
JavaScript
Extension Id
org.xwiki.platform.requirejs.module
Content to be provided
No content is expected to be provided by the user of this Extension Point.
Parameters to be provided
  • id: the RequireJS module id
  • path: maps to require.config.paths
  • bundles: optional, maps to require.config.bundles
  • deps: optional, maps to require.config.shim.deps
  • exports: optional, maps to require.config.shim.deps
  • config: optional, maps to require.config.config

Example

For instance, using this extension point with the following parameters:

id=xwiki-suggestAttachments
path=$xwiki.getSkinFile('uicomponents/suggest/suggestAttachments.js', true)

allows others to write:

require(['xwiki-suggestAttachments'], function(...) {
  // ...
});

anywhere in XWiki.

Tags:
   

Get Connected