feat(enhanced): coordinate runtime family selection - #5094
Open
ScriptedAlchemy wants to merge 17 commits into
Open
ScriptedAlchemy wants to merge 17 commits into
ScriptedAlchemy wants to merge 17 commits into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
🦋 Changeset detectedLatest commit: d077ea1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 48 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 |
@module-federation/devtools
@module-federation/cli
create-module-federation
@module-federation/dts-plugin
@module-federation/enhanced
@module-federation/error-codes
@module-federation/esbuild
@module-federation/managers
@module-federation/manifest
@module-federation/metro
@module-federation/metro-plugin-rnc-cli
@module-federation/metro-plugin-rnef
@module-federation/metro-plugin-rock
@module-federation/modern-js
@module-federation/modern-js-v3
@module-federation/native-federation-tests
@module-federation/native-federation-typescript
@module-federation/nextjs-mf
@module-federation/node
@module-federation/observability-plugin
@module-federation/playground
@module-federation/retry-plugin
@module-federation/rsbuild-plugin
@module-federation/rspack
@module-federation/rspress-plugin
@module-federation/rstest
@module-federation/runtime
@module-federation/runtime-core
@module-federation/runtime-tools
@module-federation/sdk
@module-federation/storybook-addon
@module-federation/third-party-dts-extractor
@module-federation/treeshake-frontend
@module-federation/treeshake-server
@module-federation/typescript
@module-federation/utilities
@module-federation/webpack-bundler-runtime
@module-federation/bridge-react
@module-federation/bridge-react-webpack-plugin
@module-federation/bridge-shared
@module-federation/bridge-vue3
@module-federation/inject-external-runtime-core-plugin
commit: |
ScriptedAlchemy
force-pushed
the
rfc5036/01-runtime-family-resolver
branch
2 times, most recently
from
September 18, 2026 15:33
335ca42 to
d52545d
Compare
ScriptedAlchemy
force-pushed
the
rfc5036/02-compiler-coordination
branch
from
September 18, 2026 15:36
8939c8c to
8cb38c9
Compare
Aggregate runtime requirements once after resolver setup. Keep compatibility defines while custom implementations resolve as one family. Add the default-only facade and retain the legacy Rspack bootstrap until native support is present.
ScriptedAlchemy
force-pushed
the
rfc5036/02-compiler-coordination
branch
from
September 18, 2026 16:08
8cb38c9 to
5588bd3
Compare
The selection slot change dropped the duplicate plugin check, so Rspack accepted two ModuleFederationPlugin instances in one compiler. Restore the check from main. The spec now compiles a small entry through the real plugin. It asserts the define values the bundle sees and that a child compiler inherits the parent selection.
The local-provided-version case committed ten node_modules packages that the config-case harness generates at test time. App.js does not import them.
Every setRuntimeAlias call uses the paths that prepareRuntime takes from the finalized selection. Delete getRuntimeAlias, the usePreparedPaths flag, and the custom implementation branch of resolveRuntimePaths that only they reached. The unit tests now cover the live paths.
finalizeRuntimeSelection always returns a profile and an image, so the early returns in Enhanced and Rspack never ran. Inline the one-line copySelectionToChild wrapper. Remove runtimeCapabilityDefines, which only the old Rspack spec used.
Compile a small entry through ModuleFederationPlugin and read the define values from the bundle. Check that a child compiler inherits the parent selection.
Main always set `@module-federation/runtime$` to the resolved runtime entry. This branch had started keeping a user-provided string alias instead, which changes default resolution. Restore the overwrite.
…piler-coordination
The no-remote case again configures remotes with disableRemote, as on main. The resolver now lets a plugin's disable flag win over its own remotes.
…piler-coordination
…piler-coordination
Enhanced does not depend on @module-federation/runtime. Resolving it from enhanced's own location threw MODULE_NOT_FOUND when the plugin module loaded under a strict install. Resolve runtime and the bundler runtime from the runtime-tools install, as main does.
…piler-coordination
…piler-coordination
…piler-coordination
This was referenced Sep 25, 2026
This was referenced Sep 25, 2026
ScriptedAlchemy
force-pushed
the
rfc5036/01-runtime-family-resolver
branch
from
September 26, 2026 04:58
1db1ede to
00b53e3
Compare
ScriptedAlchemy
force-pushed
the
rfc5036/02-compiler-coordination
branch
from
September 26, 2026 04:58
ef574ee to
d077ea1
Compare
This branch has not been deployed
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
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.
Part of RFC #5036. An alternate proposal is open at #5128 with its own stack. This PR stays open until the decision on #5036 is made.
Stack: 2 of 7. Base: #5093 (
rfc5036/01-runtime-family-resolver). Next: #5095.Landing order: #5093 → #5094 → #5095 → #5096 → #5097 → #5098 → #5107.
What changes
Enhanced and Rspack now pick one runtime family and one capability profile per compiler, so plugin order no longer changes the build. An incomplete custom runtime family fails the build instead of falling back to the runtime packages installed next to the plugin. A federation plugin applied to a child compiler fails the build instead of being ignored. Default builds keep the compatibility defines with the same values as
main.Only top-level federation plugins join one per-compiler selection slot.
afterResolversfinalizes the family and the capability profile, then applies one DefinePlugin with the combinedFEDERATION_OPTIMIZE_*,FEDERATION_HAS_EXPOSES, andENV_TARGETdefines. Child compilers copy the parent's finalized selection. Each plugin still writesFEDERATION_BUILD_IDENTIFIERwhen it is applied, as onmain.In Enhanced, the bootstrap path comes from the finalized family before
makewrites the entry, and installed copies of the runtime plugin share one state object. The generated runtime entry imports the bundler runtime through@module-federation/runtime-tools/dist/federation-facade.js, which re-exports@module-federation/webpack-bundler-runtime. Onmainit imports the@module-federation/webpack-bundler-runtime/bundlerentry directly. Rspack keeps its current bootstrap until native Rspack reports facade support, and it still rejects a secondModuleFederationPluginin one compiler.Package conditions stay off until the graph checks exist.
Verification
The branch history was rewritten on 2026-09-26 to remove attribution trailers from commit messages only. Every tree and patch is identical to the verified head;
d077ea196is the rewritten tip.Tests compile a small entry with each bundler's plugin. They assert the define values the bundle sees and that a child compiler inherits the parent selection.
The Enhanced unit and tree-shaking config-case Rstest suites, the Rspack Jest suite,
tscfor both packages, and Prettier pass.CI at
d077ea196passed 17 checks.e2e-metroande2e-treeshakewere skipped becausetools/scripts/ci-is-affected.mjsdid not select them for this diff.No build here sets
module-federation:*conditions, and Rspack does not use the facade.e2e-treeshakehas not run on this code. Its last run was at feat(managers): resolve runtime families atomically #5093's head.Deviations from the RFC
None noted.
Overlaps with open PRs
File overlaps with 6 other open PRs
packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.tsandpackages/enhanced/test/unit/container/FederationRuntimePlugin.test.ts. This PR does not include those changes.packages/rspack/src/ModuleFederationPlugin.ts. This PR does not include that change.packages/enhanced/src/lib/container/ModuleFederationPlugin.ts,packages/rspack/__tests__/ModuleFederationPlugin.spec.ts, andpackages/rspack/src/ModuleFederationPlugin.ts. This PR does not include those changes.packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.tsandpackages/enhanced/test/unit/container/FederationRuntimePlugin.test.ts. This PR does not include those changes.packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts. This PR does not include that change.packages/rspack/__tests__/ModuleFederationPlugin.spec.tsandpackages/rspack/src/ModuleFederationPlugin.ts. This PR does not include those changes.