fix(node,esbuild): load through the instance platform instead of federation.runtime - #5139
Open
ScriptedAlchemy wants to merge 11 commits into
Open
ScriptedAlchemy wants to merge 11 commits into
ScriptedAlchemy wants to merge 11 commits into
Conversation
…se' into rfc5128/03-node-esbuild-runtime
🦋 Changeset detectedLatest commit: 302500c 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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
@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: |
…se' into rfc5128/03-node-esbuild-runtime
…se' into rfc5128/03-node-esbuild-runtime
…se' into rfc5128/03-node-esbuild-runtime
…se' into rfc5128/03-node-esbuild-runtime
This was referenced Sep 25, 2026
…se' into rfc5128/03-node-esbuild-runtime
…TypeError The composed runtime object no longer carries loadScriptNode. When neither the instance platform nor federation.runtime can load a Node script, the plugin and the emitted chunk loader now reject with an error that names the missing platform capability, routed to the loader callback.
…se' into rfc5128/03-node-esbuild-runtime
…se' into rfc5128/03-node-esbuild-runtime
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 #5128 (alternate proposal to #5036).
Stack: 3 of 7. Base: #5137 (
rfc5128/02-bundler-runtime-compose). Next: #5134.Landing order: #5135 → #5137 → #5139 → #5134 → #5140 → #5141 → #5142.
Companions on main: #5143 (disabled remote loadEntry), #5144 (enhanced duplicate serializer keys). #5126 (@rspack/core 2) is on main. PR 6 and 7 include it.
What changes
Node hosts and esbuild containers now run on the composed bundler runtime from #5137, whose
federation.runtimehas onlyinit. On the legacy runtime they behave as before.The node runtime plugin and the chunk loader it emits call
instance.platform.loadScriptNodewhen the instance's platform has one. Otherwise they fall back tofederation.runtime.loadScriptNode, so an older runtime still works. If neither exists, the loader rejects through its callback with an error that names the missing Node platform, instead of throwing aTypeError. The esbuild container template callsbundlerRuntime.initinstead ofruntime.init.The esbuild package had no test suite. This PR adds a small jest setup for it so the container template has a behavioral test.
Verification
packages/esbuild, the container template initializes withcreateFederationfrom the composed bundler runtime and with the legacy root. The composed case failed withruntime.init is not a functionbefore this change, when the refactor(webpack-bundler-runtime): compose the bundler runtime from adapters #5137 shim had noinit.packages/node, a runtime-plugin test with a custom platform whoseloadScriptNoderecords its calls proves the platform loader is used andfederation.runtimeis not. A legacy-shaped federation object still loads through the fallback.packages/node, the same two cases run against the codegenerateLoadScriptemits.packages/node, with no loader on the platform or onfederation.runtime, the plugin and the emitted loader both pass a namedNo Node script loadererror to the callback. Both tests failed before the change.pnpm testpasses in node (59/59) and esbuild (2/2). Lint and prettier pass.@module-federation/node/runtimePluginpasses in the stack proof harness (webpack, legacy mode).88f4713e1. The full review ran at67084469e(gates, red checks, proof harness 32/32, audit). Theinstance?.platformguard and the named loader error each passed a delta review. The live head302500c86has the same patch over its parent.302500c86with 14 checks. e2e-runtime, e2e-manifest, e2e-treeshake, and e2e-metro were skipped because the affected-suite selector did not pick them.Deviations from the RFC
None.
Overlaps with open PRs
This PR carries none of the spun-out main fixes and no code from other open PRs. The PRs below change files this PR also changes. This PR does not include their changes.
node/src/runtimePlugin.tsand its test.node/src/runtimePlugin.ts.esbuild/package.json.