Replies: 2 comments
-
|
There's a RSPack plugin for RR maintained by the RSPack team focused on supporting micro-frontends |
Beta Was this translation helpful? Give feedback.
-
|
@coolRoger you can still use vite but until the @module-federation/vite plugin has proper ssr support, I've been doing the following: React Router "Framework Mode" (SSR) w/ module federationThe The Fix: Use
|
| With Plugin (Broken) | Runtime-Only (Working) |
|---|---|
| Plugin hijacks all shared imports | No build-time transformation |
| Creates CJS virtual modules | Pure ESM throughout |
| Breaks Vite SSR evaluation | SSR works normally |
require is not defined errors |
No SSR interference |
Trade-offs
⚠️ Remote components won't be SSR'd (they render a placeholder during SSR)⚠️ Slightly slower first load (manifest fetched at runtime)⚠️ Remote URL configuration moves from build-time to runtime
Summary
The @module-federation/vite plugin has fundamental incompatibilities with SSR frameworks. The runtime-only approach sidesteps these issues by:
- Not using the Vite plugin at all
- Initializing MF only in client code (
entry.client.tsx) - Using
loadRemote()with proper client-side guards - Rendering fallbacks during SSR
This is currently the most reliable way to use Module Federation with React Router in framework mode until the MF Vite plugin gains proper SSR support.
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there! 👋
I'm exploring the new Framework Mode in React Router v7 and I'm really excited about its potential for building micro-frontend architectures. However, I noticed that the documentation currently only mentions Vite as the supported build tool for this mode.
From a micro-frontend perspective, Webpack offers several advantages that make it better suited for complex enterprise applications, such as:
While Vite is a great tool, many organizations (including mine) have significant investments in Webpack-based tooling and infrastructure. It would be incredibly helpful if React Router's Framework Mode could support Webpack as well.
Could the team consider adding support for Webpack in Framework Mode or providing a tutorial on how to integrate React Router v7's Framework Mode with Webpack? This would enable more developers to take advantage of this feature without having to migrate their entire build pipeline.
Thank you for considering this request! Let me know if you need more information about specific use cases or requirements.
Beta Was this translation helpful? Give feedback.
All reactions