We have several web applications that we wish to present under one single page application. We are looking for a micro-frontend architecture/framework to use. As we see it, these are our options for implementation:
- Using the single-spa open source framework: https://github.com/CanopyTax/single-spa
- Using Iframes (friendly Iframes) the hosting application (the shell) and loading each application according to the current url.
- Writing our own Javascript framework
- Other?
The current state is a monolith FE application that consumes the other child-application as internal 3rd party packages. This approach is not scalable for us, because the hosting application is building all the products together, and nothing is really separated.
Our requirements are the usual requirements for micro-frontend:
Independent development - Each team can choose their own frameworks and build their products regardless the other products.
Independent deployment - Each application can be upgraded in production without downtime and without interfering the other applications.
Shared components - We're using Angular4 in our applications, and we have a proprietary 3rd party library (shared components and logic) that we've already wrote that should be shared among all of the products for similar look and feel.
We would like to have the ability to upgrade each application's framework (Angular, RXjs, Typescript etc and also for our proprietary component library) without caring about the other applications.
We tried to use the single-spa framework but we have some issues and we are currently found our-self thinking if this is the right approach for us, or should we try a different approach.
The issues we have using the single-spa are:
- Assets loading is problematic. (We must have the assets files on the root folder of the hosting application, and we suffer from assets conflicts when switching to another application).
- We still don't know how to handle global styling for all applications (We use sass for styling and it must be complied together with the local styles for each application)
- Upgrade angular framework (or all other frameworks) is not possible for one application, it's all or nothing (since we have one instance of angular).
- We have to implement a different bundling for development other side the hosting application (the shell).
When we think about the Iframe (using friendly Iframe) solution, we visualize a full separation between all child-application, and tend to believe this is a more suitable approach for us.
Are there any pitfalls for using Iframes?
This topic is pretty old, but still, maybe someone will find it interesting to read the answer later because it's still a very good topic.
This package you've posted in your question - https://github.com/single-spa/single-spa looks very good and we tried to work with it, however, it has too many framework-specific things, that makes onboarding for new engineers super difficult.
I think first you need to choose the approach for the microfrontend composition of your application:
I've tried to describe them with some useful links in the article https://medium.com/@danielostapenko/frontend-architecture-in-scale-for-large-organizations-593930ed10cd
Also, I would really encourage you to look at the Module Federation feature provided by Webpack 5. It looks super promising and comfortable to work within the micro-frontends world.