In the ever-evolving world of front-end development, micro frontends have emerged as a popular architecture pattern for building scalable, maintainable, and independently deployable applications. This pattern, inspired by microservices, helps developers simplify complex apps by breaking them into smaller, more manageable pieces. When paired with Webpack’s Module Federation and Callstack’s Repack, React Native development takes a leap forward by making it easier to load and share modules dynamically across applications.

This blog explores the concept of micro frontends in React Native, how to implement them using Webpack’s Module Federation, and the role of Callstack’s Repack in optimizing the build and delivery process.
What is a Micro Frontend?
Before diving into the technical implementation, let’s briefly define what a micro frontend is. A micro frontend is the front-end equivalent of microservices. In a micro frontend architecture, the user interface is decomposed into separate, smaller applications or modules that can be developed, tested, and deployed independently. These micro frontends interact seamlessly, allowing for a highly modular, scalable, and maintainable app.
In a traditional React Native app, the entire UI is typically bundled into a single large bundle. While this works well for small to medium-sized applications, as the app grows in complexity, the bundle size increases, and the app’s performance can suffer. Micro frontends allow you to break down that monolithic bundle into multiple smaller, independently managed pieces, leading to faster development cycles, better performance, and an overall more modular codebase.
How Webpack Module Federation Comes Into Play
Webpack’s Module Federation is a powerful feature that allows multiple independent builds (or micro frontends) to share code and dependencies at runtime. Traditionally, Webpack bundles JavaScript code into static files, which are then loaded into the browser or app. However, with Module Federation, Webpack can dynamically load modules from remote sources at runtime.
Module Federation enables different React Native apps (or micro frontends) to share components, libraries, and other code without needing to bundle everything into a single application. This can significantly decrease the overall bundle size and reduce load times for users.
Here’s how Webpack Module Federation fits into a React Native micro frontend setup:
- Remote Components: A React Native app can expose certain components or modules as “remotes” using Webpack’s Module Federation. These components can then be shared and used in other apps.
- Dynamic Loading: The apps can dynamically load these remote components at runtime, reducing the initial load time and allowing for real-time updates.
- Independent Deployment: Since micro frontends are independent, developers can deploy different parts of the app without worrying about breaking the entire system. This allows for faster iteration and better maintainability.

Integrating Callstack Repack with Webpack Module Federation
While Webpack Module Federation provides the dynamic loading of remote components, Callstack’s Repack adds another layer of optimization by enhancing the way we bundle React Native applications. Repack is designed specifically for React Native, providing a more efficient way of bundling and improving build times, which is crucial for large-scale applications.
Here are some of the key benefits of using Repack:
- Faster Build Times: Repack optimizes the build process for React Native apps, reducing the time it takes to create the final bundle.
- Incremental Bundling: Repack allows for incremental bundling, meaning only the modules with changes will be rebuilt, instead of rebuilding the entire app.
- Better Performance: Repack optimizes the app’s runtime performance by fine-tuning the bundling process, leading to smaller bundles and faster loading times.
When combined with Webpack Module Federation, Repack helps improve the development experience by making it faster to build and test micro frontends in React Native. This combination empowers developers to create modular, high-performance, maintainable, and scalable mobile applications.
Building a React Native App with Micro Frontends

Here are the general steps required for micro frontend implementation in a React Native app using Webpack Module Federation and Callstack Repack.
1. Set Up Your React Native Project
- Start by creating a new React Native project using the CLI:
- npx react-native init MyApp
2. Install Webpack and Module Federation
Install the necessary Webpack dependencies:
- npm install –save-dev webpack webpack-cli webpack-dev-server
- npm install –save react-native-webpack-toolkit
Additionally, install the Webpack Module Federation plugin:
- npm install –save-dev webpack-module-federation
3. Configure Webpack for React Native
Next, configure Webpack to work with React Native. Create a webpack.config.js file in the project’s root directory. Set up Webpack’s Module Federation plugin to expose remote components from a separate app (remoteApp) and share the react and react-native libraries between apps.
4. Set Up Callstack Repack
Install and configure Callstack Repack for faster builds and optimizations.
First, install Repack:
npm install –save-dev @callstack/repack
Then, configure the metro.config.js file to use Repack as the bundler for React Native:
const { getDefaultConfig } = require(‘@callstack/repack’);
module.exports = getDefaultConfig(__dirname);
This enables the optimization for Callstack Repack for faster build times and better performance when bundling a React Native app.
5. Expose and Consume Remote Components
Start exposing and consuming remote components across micro frontends.

For example, App1 in one micro frontend could expose a component:
And App2 can consume it dynamically:

In this example, the App2 consumes the ExposedComponent from App1 dynamically using Webpack’s Module Federation. The component is lazily loaded at runtime, allowing for a more modular approach to app development.
Conclusion
Building React Native apps with micro frontends can significantly enhance scalability, maintainability, and performance. Webpack’s Module Federation enables dynamic code and components share across apps, while Callstack’s Repack streamlines the build and bundling process for improved speed and efficiency.
This combination opens exciting possibilities for large-scale mobile application development and Enterprise Mobility Services, where different teams can work independently on different app segments without stepping on each other’s toes. The result is a more modular, performant, and maintainable application architecture.