This repository contains some experimental code to verify compatibility between Rspack, Webpack, and Vite module federation build outputs. The interest is mainly in dynamic remotes which are resolved at runtime.
Tool | Out of the box support | Possible to implement custom support |
---|---|---|
Rspack | ✅ | ✅ |
Webpack | ✅ | ✅ |
@module-federation/enhanced | ✅ | ✅ |
@originjs/vite-plugin-federation | ❌ | ✅ |
@module-federation/vite | ❓ | ❓ |
At the time of writing, it is possible to create a host application that accepts remote modules build by all mentioned tools. Vite has a limited support and requires some custom code to be implemented. For vite, There are multiple plugins to be chosen from.
- ✅ Out of the box compatibility
⚠️ Requires custom implementation- ❌ Not compatible
x | Rspack | Webpack | @module-federation/enhanced | @originjs/vite-plugin-federation |
---|---|---|---|---|
Rspack | x | ✅ | ✅ | |
Webpack | ✅ | x | ✅ | |
@module-federation/enhanced | ✅ | ✅ | x | |
@originjs/vite-plugin-federation | x |
None of Vite builds are compatible with @module-federation/runtime
package out of the box. Extra bridge is required. Rspack and Webpack (both the core and the @module-federation/enhanced
packages) are compatible out of the box.
Run
npm install
There are several ways of running demos:
In the project root, run the npm run dev
. This command will serve Rspack shell app, with all different remote modules output versions.
There are 4 different shell applications. They are located in these packages:
./rspack
./webpack
./webpack-native
./vite
Each of these shell apps are trying to consume remote modules from all other shell applications.
Each package with has the npm run dev
script that starts development environment and the shell app.
NOTE: Vite does not output the remote container with dev server. In order to provide the remote module for other shells to consume, run the
npm run serve
script in the./vite
package.