Skip to content

fix(mf): respect request changes in shared plugins#12863

Merged
ahabhgk merged 1 commit intomainfrom
fix-change-request-for-consume-module
Jan 27, 2026
Merged

fix(mf): respect request changes in shared plugins#12863
ahabhgk merged 1 commit intomainfrom
fix-change-request-for-consume-module

Conversation

@ahabhgk
Copy link
Copy Markdown
Contributor

@ahabhgk ahabhgk commented Jan 27, 2026

Summary

Update ConsumeSharedPlugin and ProvideSharedPlugin to use data.request instead of the original dependency request. This ensures that modifications made to the request in hooks like beforeResolve are correctly handled.

Related links

fix #11437

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Update ConsumeSharedPlugin and ProvideSharedPlugin to use data.request
instead of the original dependency request. This ensures that
modifications made to the request in hooks like beforeResolve are
correctly handled.
Copilot AI review requested due to automatic review settings January 27, 2026 08:09
@github-actions github-actions bot added release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack. labels Jan 27, 2026
@ahabhgk ahabhgk enabled auto-merge (squash) January 27, 2026 08:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a regression in Module Federation where shared dependencies were not correctly matched when custom resolvers modified the request in hooks like beforeResolve. The fix ensures that both ConsumeSharedPlugin and ProvideSharedPlugin use the modified data.request instead of the original dependency request.

Changes:

  • Updated ConsumeSharedPlugin to use data.request instead of dep.request() in the factorize hook
  • Updated ProvideSharedPlugin to use data.request instead of create_data.raw_request in the module hook
  • Added test coverage for shared modules with custom request resolution

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/rspack_plugin_mf/src/sharing/consume_shared_plugin.rs Changed to use data.request instead of dep.request() to respect request modifications from hooks
crates/rspack_plugin_mf/src/sharing/provide_shared_plugin.rs Changed to use data.request instead of create_data.raw_request to respect request modifications from hooks
tests/rspack-test/configCases/container-1-0/change-data-request/x.js Added test module for shared module testing
tests/rspack-test/configCases/container-1-0/change-data-request/rspack.config.js Added shared module configuration and custom resolver hook for myX
tests/rspack-test/configCases/container-1-0/change-data-request/bootstrap.js Added test assertion for shared module resolution

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Change
react-10k 5.7 MB 0
react-1k 825.5 KB 0
react-5k 2.7 MB 0
rome 984.2 KB 0
ui-components 2.3 MB 0

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 840c36a to chore: release 2.0.0-alpha.1 (#12860) by harpsealjs

❌ Size increased by 128bytes from 48.34MB to 48.34MB (⬆️0.00%)

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Jan 27, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing fix-change-request-for-consume-module (840c36a) with main (02936a5)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

@ahabhgk ahabhgk merged commit 7445ef1 into main Jan 27, 2026
61 checks passed
@ahabhgk ahabhgk deleted the fix-change-request-for-consume-module branch January 27, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: NormalModuleReplacementPlugin cannot work together with ModuleFederationPlugin shared

3 participants