What is a microfrontend (mfe)?
-
Single-spa allows us to connect independently running applications into our root IA app and display them as pieces of our app. They can be developed and deployed separately from our root app while being integrated and displayed.
-
A microfrontend reaches IA in one of two ways. Register it on its own, at the screen for the slot it fills. Or ship it inside a component. Both work, and the code you write is the same either way.
Developing your microfrontend
Please browse our existing microfrontends if one already meets your needs.
We recommend the following, because we have tested this approach and you can benefit from our shared utility functions, which are written in TypeScript:
-
Webpack
-
React TypeScript
Build the bundle as a SystemJS module, with libraryTarget: "system" in your webpack config. A bundle in any other format loads and never executes.
Shipping it on its own
Register the microfrontend at the screen that owns its slot, then give it a source.
|
Slot |
Where you register it |
|---|---|
|
Attribute view or edit widget |
Settings > System > Plugins > Attribute widget plugins |
|
Page |
Settings > System > Nav pages |
|
Asset tab |
Asset Types > the asset type > Asset tab settings |
|
Dashboard |
The dashboard's edit modal > General settings |
Each of those screens offers two sources:
-
Hosted URL — a URL that serves your built JavaScript entry file. Update the URL to release a new version.
-
Upload file — upload the built
.jsfile. IA stores it and serves it, so the bundle needs no public host. Upload again to release a new version.
Shipping it in a component
-
Build for production.
-
Put the bundle under
mfe/dist/in your component folder. -
Point the matching
mfes[].bundle_pathincomponent.jsonat it. -
Build the release zip and register it.
See Developing Components for the manifest and the zip layout.
Two slots are component-only: the device configuration screens and settings sections. IA finds those by reading the installed components, so there is no screen to register one on its own. Every other slot takes either method.
A component bundles its own libraries. Never add one to the host import map. Every component on the system shares that map, so a version added to suit one component changes what every other component loads.