fix: handle excluded shared keys and scoped remote names in dev bootstrap#669
Merged
gioboa merged 3 commits intomodule-federation:mainfrom Apr 29, 2026
Merged
Conversation
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Bug 1:
generateMFManifestcrashes on shared keys removed byexcludeSharedSubDependenciesThe new
excludeSharedSubDependencies(dev mode only) deletes a shared key fromoptions.sharedif it is a dependency of another shared package. But the key may already be inusedShares(added earlier bycreateEarlyVirtualModulesPlugin,enforce: "pre"). When/mf-manifest.jsonis requested,generateMFManifestiteratesusedShares, callsgetNormalizeShareItem(key)(returnsundefined), then crashes onshareItem.version. Dev server responds 500 and the host fails withRUNTIME-003: Failed to get manifest.generateLocalSharedImportMapin the same file already guards against this —generateMFManifestwas missing the same check.Repro: share two packages where one is listed as a
dependencyof the other (e.g.@scope/componentsdeps include@scope/utils, both shared).Fix in
src/plugins/pluginMFManifest.ts: switch.map()to.flatMap()and skip entries with noshareItem.Bug 2: Scoped remote names break the auto-preload bootstrap
pluginAddEntry.tsbuilds the host bootstrap with:intending to keep only sub-path entries (e.g.
remote/App) and skip bare container names (remote). For scoped remotes like@scope/remote, the/from the scope makes the bare name pass the filter. The generated bootstrap then callsruntime.loadRemote("@scope/remote")with no exposed path, which is translated into module.and fails withModule . does not exist in container. The host never boots.Repro: any host with a scoped remote (
@scope/remote) where the remote only declares sub-path exposes (no'.').Fix in
src/plugins/pluginAddEntry.ts: compare against the remote key instead of using the/heuristic.