cx-composer--for=liferay

JS Import Map Entry

Register a module for bare-specifier `import` calls.

type: jsImportMapsEntry·Frontend·Liferay docs →

# description

Adds an entry to Liferay's page-level JavaScript importmap. Other extensions can then `import x from 'my-package'` and the browser resolves it to your URL.

UI extensions that render on Liferay pages or modify page appearance.

# when to use

  • You want to share a library between multiple Custom Element extensions without bundling it into each.
  • You need vendored libraries (react, jquery, chart.js) available by bare name.
  • You're building a mini-framework that other CX packages import.

# how to use

  1. 01Ship your module (usually an ES module) at a stable URL.
  2. 02Give it a bareSpecifier — the name other code will import by.
  3. 03Consuming extensions then use import x from "bareSpecifier".

# required fields

fieldtypedescription
bareSpecifierrequiredstringModule specifier — the name used in import statements.
urlrequiredstringPath to the JS module.

# optional fields

fieldtypedescription
namestringDisplay name.
useESMbooleanLoad as an ES module.
oAuthApplicationHeadlessServerstringOptional ref code of a paired headless-server OAuth app when the module is behind auth.

# example

client-extension.yaml
chart-lib:
    type: jsImportMapsEntry
    bareSpecifier: chart-lib
    url: https://cdn.example.com/chart-lib/dist/index.js
    useESM: true

# more in frontend