-
-
Notifications
You must be signed in to change notification settings - Fork 736
Description
System Info
System:
OS: macOS 15.5
Binaries:
Node: 22.11.0
Yarn: 4.9.2
npm: 10.9.0
Browsers:
Chrome: 142.0.7444.60
npmPackages:
@rspack-canary/core@latest
Details
Enabling container.ModuleFederationPlugin (MF v1.5) throws following error in runtime:
webpack.js:1627 Uncaught Error: should have __webpack_require__.f.remotes
at __webpack_require__.f.remotes (webpack.js:1627:19)
at webpack.js:305:43
This was happening because the runtime override was called before stubbing of webpack_require.f.remotes (override only works when there's stub on that key)
I checked webpack.js and found out that bootstrap order of webpack/runtime/jsonp_chunk_loading and webpack/runtime/remotes_loading is reversed. When the order is correct the issue is resolved (verified with chrome's source override)
The jsonp_chunk_loading and remote_runtime_module has same RuntimeModuleStage priority of Attach so it's sorted alphabetically.
I was willing to make a PR but RuntimeModuleStage doesn't accept arbitary priority value 🤔 (It fallbacks to Normal when arbitary value is passed)
Reproduce link
No response
Reproduce Steps
Enable ModuleFederationPlugin v1.5 and run the dev server.
I tested it with Nextjs' latest canary.