Skip to content

module-federation/metro-mf

Repository files navigation

metro-mf

Getting Started

Prerequisites

  • Node.js version 22 (as specified in .nvmrc)
  • Corepack

In case Corepack is not available, you can install it manually:

npm install -g corepack

Setup Steps

  1. Clone the repository with submodules:
git clone --recurse-submodules -j8 [email protected]:module-federation/metro-mf.git
  1. Navigate to the project directory:
cd metro-mf
  1. Enable Corepack and install dependencies in the monorepo:
corepack enable && corepack install && yarn install
  1. Navigate to the Metro submodule:
cd external/metro
  1. Set the correct Yarn version for Metro and install dependencies:
yarn set version 1.22.22 && yarn install

Development

Set the METRO_FEDERATION_DEV environment variable in your shell:

export METRO_FEDERATION_DEV=1

Then, run the development servers for both apps:

yarn dev

Note: You can freely make changes to both the module-federation-metro package (packages/module-federation-metro) and the metro packages (external/metro). The dev server will automatically restart when changes are detected - there's no need to manually build either package.