![npm upgrade webpack npm upgrade webpack](https://cdn-media-1.freecodecamp.org/images/1*o7QEQxqK3HhR4_lMu0zvhA.png)
Because the integration happens at runtime, each micro frontend can be developed and deployed independently, without redeploying the container app. It eliminates coupling between the container and micro frontends. We will explore this in more detail in this article. One way to achieve this is using Webpack’s Module Federation plugin that takes care of bundling, exposing, and consuming dependencies at runtime.
![npm upgrade webpack npm upgrade webpack](https://i.stack.imgur.com/jQoht.png)
#Npm upgrade webpack code
The container gets access to the micro frontend’s code while it is running in the browser. Each time a micro frontend is updated, the container needs to be redeployed to integrate the update. While this is simple to set up and implement, it introduces tight coupling between the container and micro frontends. One way to achieve this is to publish micro frontends as npm packages and import them as dependencies in the container app. The container gets access to the micro frontend’s code during development/compile time. This is a divergence from the principles of modern web development or single-page apps. This is not an ideal approach as it involves making multiple server calls for rendering content on the page and requires the implementation of a well-thought caching strategy to decrease latency. Upon receiving the request from the browser, the container requests the markup by making a server call to the relevant micro frontend server. Server integrationĮach micro frontend is hosted on a (preferably separate) webserver that is responsible for rendering and serving the relevant markup. There are primarily three ways to integrate micro frontend modules with the container app. Breaking a monolithic app into smaller, manageable, decoupled micro frontends enables multiple teams to work autonomously and use their preferred frontend framework and build tools to work on incremental upgrades. Monolithic codebases are difficult to test, upgrade, scale, and maintain while limiting the team’s ability to work independently on different parts of the app and use heterogenous toolsets. The concept is similar to microservices, but for frontend codebases. The micro frontend is an architecture pattern where a single monolith front-end app is divided into multiple, smaller apps, each of which is developed and tested independently and is responsible for a distinct feature.