JS Import Map Entry
Register a module for bare-specifier `import` calls.
# 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
- 01Ship your module (usually an ES module) at a stable URL.
- 02Give it a
bareSpecifier— the name other code willimportby. - 03Consuming extensions then use
import x from "bareSpecifier".
# required fields
| field | type | description |
|---|---|---|
bareSpecifierrequired | string | Module specifier — the name used in import statements. |
urlrequired | string | Path to the JS module. |
# optional fields
| field | type | description |
|---|---|---|
name | string | Display name. |
useESM | boolean | Load as an ES module. |
oAuthApplicationHeadlessServer | string | Optional 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