r/webdev • u/DaysAreGone_ForMe • May 22 '26
Discussion Migrating 9 Micro Frontend apps from CRA + CRACO + Webpack 5 to Rspack (or Nx + Rspack) — anyone done this? What issues did you face?
I am planning a migration for a React 18 micro frontend setup and would really like feedback from people who have done something similar in production. This project is under development and not live yet.
Our Current Setup:
- 9 separate React 18 apps (separate Git repos, separate CI/CD pipelines)
- All built with CRA (react-scripts 5.0.1) + CRACO 7 + Webpack 5
- Using Webpack Module Federation for integration
- TypeScript, Redux Saga, MUI 5, PrimeReact, SASS across all apps
How our architecture works :
This is not the usual “single shell owns everything” micro frontend setup.
- The host is only a thin routing shell.
- It checks the route and dynamically loads the matching remote app at runtime.
- Each remote app is a full, standalone application with its own routes, sidebar/navbar, and Redux store, but the same app structure.
- Authentication is mostly handled centrally: the admin module handles the main login flow, and other remote apps check whether a token exists in
localStorage. If not, they redirect to the admin login route. - The host loads the remote bundle dynamically when the route matches, using the Webpack runtime federation flow and script injection at runtime. The host loads remotes using dynamic
<script>injection at runtime (__webpack_init_sharing__,window[scope].init(),container.get(module)) — not static imports in webpack config
The two options I'm evaluating:
Option A: Rspack (drop-in per app)
- Replace CRA/CRACO/Webpack config with Rspack config in each app.
- Each app stays in its own repo
- Migrate one app at a time (Rspack-built remotes produce the same
remoteEntry.jsformat, so they work with a Webpack-built host during migration)
Option B: Nx + Rspack (monorepo)
- Move all apps into an Nx monorepo.
- Use Rspack as the bundler within Nx
- Extract shared components into Nx libraries.
- Bigger migration effort, but possibly better long-term maintainability.
My specific questions
- Anyone migrated from CRA/CRACO to Rspack with Module Federation? Did you hit any issues with:
- SASS/SCSS loading?
- MUI (Material UI) compatibility?
- The
sharedsingleton config (react, react-dom, etc.)? - Dynamic remote loading (script injection pattern)?
- Module Federation compatibility between Webpack-built and Rspack-built apps
- HMR behavior in host/remote development
- Any production gotchas with multiple remotes and shared dependencies
- Rspack's Module Federation — any production gotchas? Any issues with:
- Multiple remotes sharing the same singleton deps?
- HMR working across host ↔ remote during development?
- Build output compatibility (can a Rspack-built remote be loaded by a Webpack-built host and vice versa)?
- Anyone using Nx + Rspack for MFE at scale? How painful was the monorepo migration? Did Nx's caching actually help with 9 apps, or is it overkill?
- Is there a better option I'm not considering? I've already ruled out Vite Module Federation (our
loadRemoteComponentuses__webpack_init_sharing__which is Webpack-specific, and Vite's MF plugin is still experimental). But open to hearing alternatives. - For those who did the Rspack migration, how much did
src/the code change? My understanding is zero source code changes, only config/build files. Is that actually true in practice? - Where can I find detailed exercises, hands-on tutorials, or production-grade examples of setting up and customizing micro-frontends specifically using Rspack or Nx + Rspack?
For Nx users:
- How do teams maintain separate remote apps inside one Nx monorepo in practice?
- Does Nx actually help with build caching and developer workflow at this scale?
- How painful is the migration if the apps are already independent today?
I am also open to alternatives if there is a better path I have not considered.
At the moment, I am leaning toward migrating one app at a time to Rspack first, then deciding whether a full Nx monorepo makes sense later. But I would really like to hear from people who have done this before and what they would do differently.
5
u/Triggerscore May 22 '26
Glad I don't have to do this 🙈 sadly no experience with migrations in react cosmos
4
u/Tarazena May 22 '26
It’s been a while since I’ve NX, but what I’ve did for a company to basically create shared libraries in lib folder, and create different apps inside apps folder, and deploy those via containers.
One thing I didn’t like that much about NX is how it handles package build process, etc. via project.json. I know just use pnpm workspaces mainly for multisite monorepo.
3
u/Dependent-Guitar-473 May 22 '26
why not option 1 then option 2? to avoid major changes at once? and option 1 sounds like a precursor to option 2 anyway? after all all turbo repo or NX are a task runners and run your build tasks that should be ready before hands
2
u/30thnight expert May 23 '26 edited May 23 '26
Stick to Option A to limit your blast radius.
But I’m chuckling at option B because had this project started off with a monorepo setup and solid tooling to begin with, there’s a very good chance that you could have avoided the need for module federation entirely.
2
u/resume-razor May 23 '26
Module federation is the main bottleneck since CRACO abstracts so much of the webpack config, forcing you to manually rewrite the overrides. start with a single app to figure out the shared scope dependencies before touching the other eight.
2
u/mohab-intuita Jun 16 '26
I’d stick with Option A first.
Changing the bundler and moving 9 apps into a monorepo at the same time sounds like a great way to make every failure ambiguous. If something breaks, you won’t know if it’s Rspack, Module Federation, Nx, package resolution, caching, or just a CRA assumption leaking through.
I’d treat the first app as a spike, not “the migration”. Use it to build the checklist for the other 8:
__webpack_init_sharing__/container.get()path tested, not just static federation configreact,react-dom, router, MUI/emotion, etc.REACT_APP_*, SVGR imports, CSS modules naming, asset paths, public path@import,@use, nested declarationsremoteEntry.jscaching/versioning testedMy guess is
src/won’t be zero-change in practice. Not because Rspack needs React changes, but because CRA/CRACO hid a bunch of behavior that your source may accidentally rely on.Small disclosure: I'm part of the core team at Codemod (the company behind the codemod OSS project). We’ve done bundler migration work in this area before; webpack’s v5 migration guide links to Codemod’s webpack v5 migration recipe. Different migration, but same lesson: do app #1 manually enough to learn the edge cases, then turn the repeatable parts into checks/scripts/codemods instead of hand-patching 8 more repos.
I’d postpone Nx until Rspack is boring. Once the apps build/run cleanly, then you’ll have a much clearer idea whether Nx solves a real workflow problem or just adds another migration.
FYI, if you'd like to chat more and maybe connect you with people who can support you during this migration, feel free to ping me on slack.
3
u/[deleted] May 23 '26
[removed] — view removed comment