You can't do this with a plain static site solution. You have to use some back-end. The issue is that you need to provide a list of micro-frontend-applications (mfa) dynamically, so you have to alter at least something.
The simplest way to achieve this would be:
- Create a script (lets name it Loader) that knows how to load scripts dynamically (see
document.createElement
).
- Create an API endpoint that will return the list of scripts, that should be loaded. (here back-end appears)
- Update Loader to use API to get the list of micro frontends you want to load.
Now, your the schema should be like this:
--> Index.html started
--> Loader do fetch for the list of the mfa scripts
--> Loader adds listed scripts dynamically
--> Applications start working
When you need to change the list of apps, you don't need to redeploy anything. Just change the API response (by updating the DB, config, or whatever you want) and it will work.
This is not ideal (very not ideal from a performance perspective, but will work for the plain static site).
The better way (if you have a back-end) is to generate the page on the fly and embed your scripts with applications dynamically on the server-side. It is much simpler and might be faster, cause you don't need to wait for a call to the API to get the mfa list.
Hope this helps.
P.S. Using dynamic script loading might be dangerous. If you decide to do the first way, don't forget to verify that all scripts are trusted. You might use Content-Security-Policy for example.