Composing micro frontends dynamically
We briefly introduced the idea of using a central web component registry to lazily load the different scripts required to make the web components work. This would indeed be the ultimate solution, as it is lazy yet dynamic. However, to make this fully operational is also not easy. An easier way is to start with a micro frontend discovery service.
Using a micro frontend discovery service
A micro frontend discovery service is similar to the link dictionary introduced in Chapter 6. However, instead of a server resolution, it would just return paths to all the available scripts.
For example, the following API response could be triggered for the tractor store sample:
{ "scripts": [ "http://localhost:2001/product-page.js", "http://localhost:2002/basket-info.js", "http://localhost:2002/buy-button.js", ...