-
-
Notifications
You must be signed in to change notification settings - Fork 781
feat: flag shared modules used exports #11413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ScriptedAlchemy
wants to merge
9
commits into
main
Choose a base branch
from
flag-mf-exports
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
…ing prevention Add ShareUsagePlugin to track shared module usage and prevent tree-shaking for module federation Add shared_key field to BuildMeta for tree-shaking analysis Improve ProvideSharedPlugin with better shared module handling Add documentation explaining module federation tree-shaking behavior
Add detailed documentation explaining: 1. How module federation prevents tree-shaking in Rspack 2. Rspack's tree-shaking implementation details 3. Proposed solution for enabling tree-shaking with module federation
…for-module-federation Enable parsing share-usage metadata for shared module tree shaking
# Conflicts: # Cargo.lock # crates/rspack_plugin_mf/src/container/module_federation_runtime_plugin.rs # crates/rspack_plugin_mf/src/sharing/consume_shared_plugin.rs
✅ Deploy Preview for rspack ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- Remove invalid PluginContext import - Add missing async_trait import - Fix apply method signature to match Plugin trait - Fix context field accesses by removing intermediate .context - Fix collapsible if statement clippy warning
📦 Binary Size-limit
❌ Size increased by 102.88KB from 47.61MB to 47.71MB (⬆️0.21%) |
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.
This pull request introduces tree-shaking support for shared modules in module federation, allowing unused exports in shared modules to be eliminated based on usage information. The implementation involves extending build metadata, updating the plugin system to read usage reports, and adding a new test case to verify the feature.
Tree-shaking for shared modules in module federation:
Core feature implementation:
BuildMeta
inrspack_core
to include new fields (consume_shared_key
,shared_key
,is_shared_descendant
,effective_shared_key
) to support export usage tracking for shared modules. [1] [2]Module
trait to provide access to the newconsume_shared_key
field.Plugin and runtime changes:
FlagDependencyUsagePlugin
to read ashare-usage.json
report and update export usage states for shared modules based on this report. [1] [2]ShareUsagePlugin
into theModuleFederationRuntimePlugin
flow, ensuring export usage information is processed during compilation. [1] [2] [3] [4]ProvideSharedPlugin
to set theshared_key
in build metadata for various shared module resolution strategies, enabling correct matching with usage reports. [1] [2] [3] [4]Supporting changes and tests:
consume-shared-tree-shaking
) with a sample shared module, usage report, and configuration to verify that unused exports are correctly tree-shaken. [1] [2] [3] [4]Other minor changes:
Development and tooling:
.vscode/launch.json
. [1] [2]serde
as a workspace dependency forrspack_plugin_javascript
.Bugfix:
These changes collectively enable tree-shaking for shared modules in module federation, improving bundle size and correctness by eliminating unused exports based on actual usage.