Micro-Frontends' configuration and deployment processes are known to be complicated and painful to debug. Zephyr Cloud not only to helps with resolving dynamic URL and development process for applications applying Micro-Frontends architecture, but also deployment, versioning and more. This section will walk through the necessary configuration to ensure you have a smooth development workflow and deployment process.
We have first class support for a Micro-Frontends architecture based on Module Federation. Other Micro-Frontends architectures may already work or will be supported in the future.
An example working shell app's configuration can be seen below as well as in our example repository
At the moment. when we are resolving your remote dependencies, we will need the remotes to be built first. Be wary that the first built remotes should not be consuming any other remotes.
In the example below where you have one shell and one remote, you will need to build the remote first.
Let's take a look at another example. You have a shell application, within the shell app you have two modules: HeaderNav and TaskContent.
The HeaderNav exposes Logo, UserProfileInfo and LeftNav.
The TaskContent exposes SearchBar.
In this scenario, LeftNav is consumed by TaskContent; SearchBar is consumed by HeaderNav.
You will need to build either the TaskContent or the HeaderNav first, comment out the remotes that have yet built and add them back later.
package.json
name and Module Federation configMake sure your remotes' package.json name
field is exactly the same as your Module Federation Configurations like so:
You may refer to how each zephyr options were resolved here
Several details related to git are required to have a successful deployment.
Do you have the admin or editor access to the application you are trying to deploy? You can check it on Zephyr Dashboard.
If you don't have it yet, you can contact your Admin on Zephyr dashboard to invite you and set up the correct access right.
Although we resolve your application's configuration, git, package.json information to understand your application's deployment information and details, you can also opt to pass in configuration directly.
Some options are resolved based on where bundler locates so be mindful about hoisting dependencies or not having a package.json in each application when you try to deploy an application through Zephyr - especially when you are deploying Micro-Frontend applications.
Each options is resolved like so, take create-nx-workspace-mf's shell
app as an example: