Skip to main content
Version: 2.x

🖼 microfrontend-loader

info

Available since v2.2.0

Logical web component that encapsulates the ability to load a standalone microfrontend.

Microfrontends loaded via microfrontend-loader are not controlled by micro-lc in terms of routing.

Usage​

caution

This component is intended to be used inside micro-lc either in the layout composable section or in a compose microfrontend, since it makes use of micro-lc API and the compose API.

You can use it standalone, but you will have to manually provide a matching API with the property microlcApi.

The component can be sourced from jsDelivr CDN or from mia CDN

To use the component in micro-lc, declare it as part of a compose application including its properties and attributes.

my-compose-application.config.json
{
"sources": "https://cdn.jsdelivr.net/npm/@micro-lc/orchestrator@latest/dist/microfrontend-loader.js",
"content": [
{
"tag": "microfrontend-loader",
"properties": {
// See properties & attributes table below
"application": {
"integrationMode": "parcel",
"entry": "/my-application/index.html"
}
},
},
{
"tag": "microfrontend-loader",
"booleanAttributes": ["disable-shadow-dom"],
"properties": {
// See properties & attributes table below
"application": {
"integrationMode": "compose",
"config": {
"content": "Hello!"
}
}
}
}
]
}

Properties & attributes​

PropertyAttributeTypeDefaultDescription
application-RoutelessApplication-The microfrontend to be loaded configuration
-disable-shadow-dombooleanfalseWhether <microfrontend-loader></microfrontend-loader> should mount its application in Shadow DOM.
-disable-stylingbooleanfalseDisable <microfrontend-loader></microfrontend-loader> preset styling.

RoutelessApplication​

A RoutelessApplication is any Application without the route property since any microfrontend, loaded by another microfrontend controlled by micro-lc, does not acquire orchestration in terms of router.

Shared​

PropertyTypeDefaultDescription
integrationModeiframe | compose | parcelRequiredsee integrationMode
...extra properties related to the choice of an integrationMode

when "integrationMode": "iframe"​

PropertyTypeDefaultDescription
srcString-the iframe source
srcdocString-alternative to src, the HTML injected into the iframe
attributesRecord<string, string>-attributes to provide to the iframe tag

when "integrationMode": "compose"​

PropertyTypeDefaultDescription
configPluginConfiguration-the compose configuration

when "integrationMode": "parcel"​

PropertyTypeDefaultDescription
entryEntry-the entry html or resources of the parcel application
propertiesProperties-must be serializable, a dictionary of properties to inject on application mount