Skip to content

feat: enhance HoistContainerReferencesPlugin for better module hoisting #3903

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

Open
wants to merge 2 commits into
base: refactor/hook-renaming-cleanup-v2
Choose a base branch
from

Conversation

ScriptedAlchemy
Copy link
Member

Summary

  • Enhanced HoistContainerReferencesPlugin to improve module hoisting for runtime chunks
  • Better support for runtimeChunk: 'single' configuration
  • Proper handling of remote modules using the new addRemoteDependency hook

Key Improvements

  1. Separate dependency handling: Container, federation runtime, and remote dependencies are now handled separately for better control
  2. Improved runtime chunk support: Changed runtime chunk detection to include all chunks with runtime (not just entry chunks)
  3. Remote module hoisting: Properly hoists remote modules using the new addRemoteDependency hook
  4. Simplified cleanup logic: More efficient cleanup that only disconnects modules from non-runtime chunks
  5. Comprehensive tests: Added unit tests to ensure the plugin works correctly

Files Changed

  • packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts - Enhanced implementation
  • packages/enhanced/test/compiler-unit/container/HoistContainerReferencesPlugin.test.ts - New unit tests

This PR builds on PR #2 (hook renaming) and uses the new hook names.

🤖 Generated with Claude Code

- Separate handling for container, federation, and remote dependencies
- Improved support for runtimeChunk: 'single' configuration
- Proper remote module hoisting using the new addRemoteDependency hook
- Simplified cleanup logic for better performance
- Changed runtime chunk detection to include all chunks with runtime
- Added comprehensive unit tests
Copy link

changeset-bot bot commented Jul 12, 2025

🦋 Changeset detected

Latest commit: abaf4f5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 33 packages
Name Type
@module-federation/enhanced Patch
@module-federation/modern-js Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/rsbuild-plugin Patch
@module-federation/rspress-plugin Patch
@module-federation/storybook-addon Patch
@module-federation/modernjsapp Patch
remote5 Patch
website-new Patch
@module-federation/runtime Patch
@module-federation/rspack Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/sdk Patch
@module-federation/runtime-tools Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/dts-plugin Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/devtools Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/retry-plugin Patch
@module-federation/data-prefetch Patch
@module-federation/error-codes Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/runtime-core Patch
create-module-federation Patch
@module-federation/cli Patch
@module-federation/esbuild Patch
@module-federation/utilities Patch

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant