Skip to content

feat(rspack): support eager exposes - #5023

Open
2heal1 wants to merge 1 commit into
mainfrom
feat/rspack-expose-eager-plugin
Open

feat(rspack): support eager exposes#5023
2heal1 wants to merge 1 commit into
mainfrom
feat/rspack-expose-eager-plugin

Conversation

@2heal1

@2heal1 2heal1 commented Sep 2, 2026

Copy link
Copy Markdown
Member

Description

Add opt-in eager: true support for Rspack exposes without changing Rspack itself. Eager expose modules are included in the container entry chunk, avoiding a separate async chunk request while preserving the asynchronous container.get() contract and deferring module evaluation until the exposed factory is called.

The enhanced Rspack ModuleFederationPlugin applies the behavior automatically. ExposeEagerPlugin is also exported from @module-federation/rspack/plugin for use alongside Rspack's built-in module federation plugin. Integration tests cover both forms with a container-only entry: {} configuration and verify eager versus lazy output assets.

Validation run:

  • pnpm exec turbo run build --filter=@module-federation/rspack
  • pnpm exec turbo run lint --filter=@module-federation/rspack --force
  • pnpm exec turbo run test --filter=@module-federation/rspack --force
  • pnpm exec prettier --check packages/rspack/src/ExposeEagerPlugin.ts packages/rspack/src/ModuleFederationPlugin.ts packages/rspack/__tests__/ExposeEagerPlugin.spec.ts packages/rspack/README.md .changeset/eager-exposes-rspack.md

The full-repository pnpm exec prettier --check . remains blocked by 682 pre-existing generated files, primarily under apps/website-new/doc_build; none are part of this branch.

Related Issue

No related issue.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c754723

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

This PR includes changesets to release 48 packages
Name Type
@module-federation/rspack Patch
@module-federation/enhanced Patch
@module-federation/modern-js-v3 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/rstest Patch
@module-federation/storybook-addon Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
node-dynamic-remote-new-version Patch
node-dynamic-remote Patch
@module-federation/playground Patch
remote5 Patch
remote6 Patch
website-new Patch
@module-federation/devtools Patch
@module-federation/cli Patch
create-module-federation Patch
@module-federation/dts-plugin Patch
@module-federation/error-codes Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/metro Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/metro-plugin-rnef Patch
@module-federation/metro-plugin-rock Patch
@module-federation/retry-plugin Patch
@module-federation/runtime-core Patch
@module-federation/runtime-tools Patch
@module-federation/runtime Patch
@module-federation/sdk Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/treeshake-frontend Patch
@module-federation/treeshake-server Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/bridge-react Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-vue3 Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/esbuild Patch
@module-federation/observability-plugin 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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T08:16:54.413465Z c754723 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Sep 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

@module-federation/devtools

pnpm add https://pkg.pr.new/@module-federation/devtools@c754723

@module-federation/cli

pnpm add https://pkg.pr.new/@module-federation/cli@c754723

create-module-federation

pnpm add https://pkg.pr.new/create-module-federation@c754723

@module-federation/dts-plugin

pnpm add https://pkg.pr.new/@module-federation/dts-plugin@c754723

@module-federation/enhanced

pnpm add https://pkg.pr.new/@module-federation/enhanced@c754723

@module-federation/error-codes

pnpm add https://pkg.pr.new/@module-federation/error-codes@c754723

@module-federation/esbuild

pnpm add https://pkg.pr.new/@module-federation/esbuild@c754723

@module-federation/managers

pnpm add https://pkg.pr.new/@module-federation/managers@c754723

@module-federation/manifest

pnpm add https://pkg.pr.new/@module-federation/manifest@c754723

@module-federation/metro

pnpm add https://pkg.pr.new/@module-federation/metro@c754723

@module-federation/metro-plugin-rnc-cli

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnc-cli@c754723

@module-federation/metro-plugin-rnef

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnef@c754723

@module-federation/metro-plugin-rock

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rock@c754723

@module-federation/modern-js

pnpm add https://pkg.pr.new/@module-federation/modern-js@c754723

@module-federation/modern-js-v3

pnpm add https://pkg.pr.new/@module-federation/modern-js-v3@c754723

@module-federation/native-federation-tests

pnpm add https://pkg.pr.new/@module-federation/native-federation-tests@c754723

@module-federation/native-federation-typescript

pnpm add https://pkg.pr.new/@module-federation/native-federation-typescript@c754723

@module-federation/nextjs-mf

pnpm add https://pkg.pr.new/@module-federation/nextjs-mf@c754723

@module-federation/node

pnpm add https://pkg.pr.new/@module-federation/node@c754723

@module-federation/observability-plugin

pnpm add https://pkg.pr.new/@module-federation/observability-plugin@c754723

@module-federation/playground

pnpm add https://pkg.pr.new/@module-federation/playground@c754723

@module-federation/retry-plugin

pnpm add https://pkg.pr.new/@module-federation/retry-plugin@c754723

@module-federation/rsbuild-plugin

pnpm add https://pkg.pr.new/@module-federation/rsbuild-plugin@c754723

@module-federation/rspack

pnpm add https://pkg.pr.new/@module-federation/rspack@c754723

@module-federation/rspress-plugin

pnpm add https://pkg.pr.new/@module-federation/rspress-plugin@c754723

@module-federation/rstest

pnpm add https://pkg.pr.new/@module-federation/rstest@c754723

@module-federation/runtime

pnpm add https://pkg.pr.new/@module-federation/runtime@c754723

@module-federation/runtime-core

pnpm add https://pkg.pr.new/@module-federation/runtime-core@c754723

@module-federation/runtime-tools

pnpm add https://pkg.pr.new/@module-federation/runtime-tools@c754723

@module-federation/sdk

pnpm add https://pkg.pr.new/@module-federation/sdk@c754723

@module-federation/storybook-addon

pnpm add https://pkg.pr.new/@module-federation/storybook-addon@c754723

@module-federation/third-party-dts-extractor

pnpm add https://pkg.pr.new/@module-federation/third-party-dts-extractor@c754723

@module-federation/treeshake-frontend

pnpm add https://pkg.pr.new/@module-federation/treeshake-frontend@c754723

@module-federation/treeshake-server

pnpm add https://pkg.pr.new/@module-federation/treeshake-server@c754723

@module-federation/typescript

pnpm add https://pkg.pr.new/@module-federation/typescript@c754723

@module-federation/utilities

pnpm add https://pkg.pr.new/@module-federation/utilities@c754723

@module-federation/webpack-bundler-runtime

pnpm add https://pkg.pr.new/@module-federation/webpack-bundler-runtime@c754723

@module-federation/bridge-react

pnpm add https://pkg.pr.new/@module-federation/bridge-react@c754723

@module-federation/bridge-react-webpack-plugin

pnpm add https://pkg.pr.new/@module-federation/bridge-react-webpack-plugin@c754723

@module-federation/bridge-shared

pnpm add https://pkg.pr.new/@module-federation/bridge-shared@c754723

@module-federation/bridge-vue3

pnpm add https://pkg.pr.new/@module-federation/bridge-vue3@c754723

@module-federation/inject-external-runtime-core-plugin

pnpm add https://pkg.pr.new/@module-federation/inject-external-runtime-core-plugin@c754723

commit: c754723

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Report

8 package(s) changed, 35 unchanged.

Package dist + ESM entry

Package Total dist (raw) Delta ESM gzip Delta
@module-federation/playground 28.91 MB -686 B (-0.0%) 45.7 kB no change
@module-federation/rspack 66.0 kB +9.6 kB (+17.0%) 161 B no change

Bundle targets

Package Web bundle (gzip) Delta Node bundle (gzip) Delta
@module-federation/cli 2.3 kB -2 B (-0.1%) 2.4 kB -31 B (-1.3%)
@module-federation/core 1.0 kB -5 B (-0.5%) 1.0 kB -32 B (-2.9%)
@module-federation/devtools 30.3 kB no change 30.3 kB -23 B (-0.1%)
@module-federation/enhanced 2.7 kB +4 B (+0.1%) 2.8 kB -42 B (-1.5%)
@module-federation/metro-plugin-rnc-cli 416 B -1 B (-0.2%) 435 B -25 B (-5.4%)
@module-federation/node 9.1 kB -1 B (-0.0%) 9.2 kB -28 B (-0.3%)
@module-federation/rspack 3.1 kB +415 B (+15.2%) 3.1 kB +412 B (+15.0%)

Consumer scenarios

Scenario Web output (gzip) Delta Node output (gzip) Delta Gap (node-web) Delta
Enhanced remoteEntry 22.3 kB -16 B (-0.1%) 23.8 kB -17 B (-0.1%) +1.6 kB -1 B

Total dist (raw): 36.17 MB (+8.9 kB (+0.0%))
Total ESM gzip: 111.4 kB (no change)
Total web bundle (gzip): 253.5 kB (+410 B (+0.2%))
Total node bundle (gzip): 255.7 kB (+231 B (+0.1%))
Tracked ./bundler entry gzip: 563 B (no change)
Tracked ./bundler web bundle (gzip): 4.9 kB (no change)
Tracked ./bundler node bundle (gzip): 4.9 kB (no change)

Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as ./bundler are measured separately so ENV_TARGET-driven tree-shaking is visible. Bare imports are externalized to keep package-level sizes consistent, and assets are emitted as resources.

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