diff --git a/README copy.md b/README copy.md new file mode 100644 index 0000000..d75f5f6 --- /dev/null +++ b/README copy.md @@ -0,0 +1,20 @@ +# repack-examples + +This is a repository with example applications for [Re.Pack](https://github.com/callstack/repack). + +## Example Applications +- __ESBuild__: The application that uses __ESBuild Minify Plugin__ and `esbuild-loader` under the hood +- __Local Chuncks__: The application that uses Repack local chuncks feature +- [__Module Federation__](./module-federation/MODULE_FEDERATION.md): Huge yarn workspaces that consist of 3 application and 1 module, that could run as standalone applications or running host app with other applications modules usage inside it with __Webpack Module Federation__ feature configured +- __SWC__: The application using `swc-loader` inside webpack configuration + +## Setup +1. Run `yarn` command inside root folder to install all dependencies in all the application +2. Run `yarn workspace run bootstrap` command for every workspace to install yarn dependencies and pods + +## Running +1. Run `yarn workspace run start` commmand for any workspace you want to run dev server +2. Run `yarn workspace run ios` commmand for any workspace you want to run ios app +3. Run `yarn workspace run android` commmand for any workspace you want to run android app + + diff --git a/module-federation/MODULE_FEDERATION.md b/module-federation/MODULE_FEDERATION.md new file mode 100644 index 0000000..e7bbbb1 --- /dev/null +++ b/module-federation/MODULE_FEDERATION.md @@ -0,0 +1,26 @@ +# Module Federation Example Application + +Module Federation functionality was introduced in Webpack 5. It helps to share the code between loosely coupled applications, sharing the same build system optimized for caching. It helps distributed teams to ship large applications faster. Re.Pack 3 ships with Module Federation support out-of-the-box. + +Module federation is one of the approaches to create Micro-Frondends architecture for your application. There are the host app that runs firstly on the device and MFEs apps that are used by the host app. That means each container (MFE) that is used by host application could be deployed and maintained independently, so no need to re-deploy host app if any of the containers were changed and re-deployed. This is the key feature of Module Federation. Each team could independently work on any of the packages and deploy it anytime, so the host app will see the changes immediately. + +## Application Structure +// TODO + +## Basic Setup +1. Go to `module-federation` folder `cd module-federation` +2. Run `yarn bootstrap` + +## Basic Run +If we want to check Module Federation in action, we have to run `host` application first. Host application uses other remotes containers under the hood. + +1. Run `yarn start` +2. Run `yarn run:host:ios` +3. Run `yarn run:host:android` + +## Standalone Run +As was mentions before we could run any of containers as a standaline application (`app1` / `app2` / `module1`). + +1. Run `yarn start:standalone:` +2. Run `yarn run::ios` +3. Run `yarn run::android` \ No newline at end of file