fix(enhanced): resolve protocol requiredVersion from installed package - #5
Open
tonoizer wants to merge 1 commit into
Open
fix(enhanced): resolve protocol requiredVersion from installed package#5tonoizer wants to merge 1 commit into
tonoizer wants to merge 1 commit into
Conversation
When shared dependencies use package-manager protocol specifiers (catalog:, workspace:*, npm:, patch:, file:, link:, portal:), auto requiredVersion no longer becomes '' or the protocol string. Consume falls back to ^<installed version> from the resolved package.json.
Bundle Size Report7 package(s) changed, 36 unchanged. Package dist + ESM entry
Bundle targets
Consumer scenarios
Total dist (raw): 36.16 MB (+1.7 kB (+0.0%)) Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as |
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.
What changed
Auto
requiredVersionfor shared consumes no longer treats package-manager protocol dependency strings (catalog:,catalog:name,workspace:*,npm:…,patch:,file:,link:,portal:) as usable version ranges.When the app
package.jsonlists such a specifier,@module-federation/enhancednow falls back to the installed package’s.versionand setsrequiredVersionto^<installed>(for example^19.2.4). Plain semver ranges inpackage.json(^18.2.0,*) are unchanged, and git URL dependencies keep existingnormalizeVersionbehavior.Why
Protocol strings are not semver.
normalizeVersionpreviously turned them into'', and Consume treated that as “found,” so runtime matching failed or warned and users had to pinrequiredVersionby hand.Impact
Apps using pnpm/yarn/bun catalogs or workspace/npm aliases with Module Federation shared deps get a real caret range from the resolved install without manual
requiredVersion.Validation
pnpm exec turbo run build --filter=@module-federation/enhanced...pnpm exec rstestforrequiredVersion-protocol.test.ts,ConsumeSharedPlugin.createConsumeSharedModule.test.ts, allConsumeSharedPlugin/unit tests, andutils-filtering.test.ts.changeset/fix-shared-required-version-protocols.mdSkipped full
test:packages/ci:local(change is scoped to enhanced sharing utils + ConsumeSharedPlugin).