fix(rspack): only patchChunkSplit when config set exposes#3095
Conversation
🦋 Changeset detectedLatest commit: 83c3f44 The changes in this PR will be included in the next version bump. This PR includes changesets to release 39 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Summary
The pull request fixes an issue in the rspack package's ModuleFederationPlugin.ts file. The changes ensure that the _patchChunkSplit method is only applied when the containerManager.enable flag is set. Additionally, the containerManager.init method is moved to be called before the _patchChunkSplit method, and the containerManager.containerPluginExposesOptions is assigned to the options.exposes property. These changes help to improve the integration of the Module Federation functionality with the existing codebase.
File Summaries
| File | Summary |
|---|---|
| packages/rspack/src/ModuleFederationPlugin.ts | The code changes introduce a conditional check to only apply the _patchChunkSplit method when the containerManager.enable flag is set. Additionally, the containerManager.init method is moved to be called before the _patchChunkSplit method, and the containerManager.containerPluginExposesOptions is assigned to the options.exposes property. |
There was a problem hiding this comment.
Incremental Review
Comments posted: 1
Configuration
Squadron Mode: essential
Commits Reviewed
cf14509062fd942b5763e8c757b4eb07a865611f...83c3f446e8176fda4dfd3340b277ea0449b5c30b
Files Reviewed
- packages/rspack/src/ModuleFederationPlugin.ts
Files Ignored
These files were ignored due to the filter in the squadron.yaml file.
- .changeset/tricky-sheep-travel.md
| if (containerManager.enable) { | ||
| this._patchChunkSplit(compiler, options.name); | ||
| } |
There was a problem hiding this comment.
Consider extracting the condition into a descriptive variable for better readability:
| if (containerManager.enable) { | |
| this._patchChunkSplit(compiler, options.name); | |
| } | |
| const shouldPatchChunkSplit = containerManager.enable && options.exposes; | |
| if (shouldPatchChunkSplit) { | |
| this._patchChunkSplit(compiler, options.name); | |
| } |
This change makes the intention clearer and allows for easier expansion of the condition if needed in the future.
Description
only patchChunkSplit when config set exposes
Related Issue
Types of changes
Checklist