Repository navigation
feat!: compose the federation runtime by default and remove the capability defines #5142
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
base: rfc5128/06-rspack-composed
Are you sure you want to change the base?
Changes from 1 commit
36c7e8f
bd074d9
d01ec17
fe83d46
187dfdd
22c1db4
60e40ab
5cdbb5f
b7a13a4
ca1e839
940685d
cc8cf9a
7b46e85
7849bfc
8bdf981
f1fe068
52ce340
00109f5
dd2a305
34ecd25
eb706c8
9c782c3
5ac49cb
2840f62
453999c
21e2f48
3052ce6
295d730
b0a6c25
001e19c
4989a4a
0e7bc2b
571ef30
cf40a35
6fff0f9
a5cf4b0
8f40ea8
9805677
76bd8b7
df9aa3a
b27e763
953ceeb
1f51217
f6d2e8b
729099e
9f596f0
9861d70
db5159f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| '@module-federation/runtime-core': major | ||
| '@module-federation/runtime': major | ||
| '@module-federation/webpack-bundler-runtime': major | ||
| '@module-federation/enhanced': major | ||
| '@module-federation/rspack': major | ||
| '@module-federation/sdk': major | ||
| '@module-federation/node': major | ||
| --- | ||
|
|
||
| The composed federation runtime is the default and only bootstrap. `ModuleFederationPlugin` now always generates a bootstrap that imports only the runtime parts the build uses, and `experiments.composedRuntime` is removed. | ||
|
|
||
| Removed: | ||
|
|
||
| - The `FEDERATION_OPTIMIZE_NO_SHARED`, `FEDERATION_OPTIMIZE_NO_REMOTE`, `FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN`, `FEDERATION_HAS_EXPOSES`, and `FEDERATION_BUILD_IDENTIFIER` defines. The plugins no longer emit them and the runtime no longer reads them. Use `experiments.optimization.disable*` with the plugin, or import the capabilities you need from `@module-federation/runtime/compose` when you bundle the runtime yourself. | ||
| - `__webpack_require__.federation.runtime`. Use `__webpack_require__.federation.instance`, and `instance.platform.loadScriptNode` for the Node loader. | ||
| - The fallback in `@module-federation/node` to `federation.runtime.loadScriptNode`. | ||
|
|
||
| A build whose installed runtime packages do not export the composition subpaths now fails with an error that names the minimum runtime version. `ENV_TARGET`, `FEDERATION_ALLOW_NEW_FUNCTION`, and `FEDERATION_DEBUG` are unchanged. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ | |
| export type CoveredByOptions = typeof COVERED_BY_OPTIONS; | ||
|
|
||
| const usesSharedContainerPlugin = (compiler: Compiler) => | ||
| compiler.options.plugins.some( | ||
|
Check failure on line 59 in packages/enhanced/src/lib/container/runtime/FederationCompositionPlugin.ts
|
||
| (plugin) => | ||
| typeof plugin === 'object' && | ||
| plugin !== null && | ||
|
|
@@ -196,10 +196,17 @@ | |
| compilation: Compilation, | ||
| { family, entry, legacyReason }: Outcome, | ||
| ) { | ||
| if (legacyReason !== undefined) { | ||
| const { externalRuntime, provideExternalRuntime } = | ||
| this._options.experiments ?? {}; | ||
| // An externalized runtime is the full runtime by request; the other reasons are worth a warning. | ||
| if ( | ||
| legacyReason !== undefined && | ||
| !externalRuntime && | ||
| !provideExternalRuntime | ||
| ) { | ||
| compilation.warnings.push( | ||
| new WebpackError( | ||
| `experiments.composedRuntime is set, but this build uses the full federation runtime because ${legacyReason}.`, | ||
| `This build uses the full federation runtime because ${legacyReason}.`, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When an installed runtime family is too old and lacks a required composition export, Useful? React with 👍 / 👎. |
||
| ), | ||
| ); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -531,7 +531,7 @@ class FederationRuntimePlugin { | |
| // dont run multiple times on every apply() | ||
| if (!onceForCompiler.has(compiler)) { | ||
| const options = this.options; | ||
| if (options?.experiments?.composedRuntime) { | ||
| if (options) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With this unconditional Useful? React with 👍 / 👎. |
||
| new FederationCompositionPlugin(options, (composition) => { | ||
| const source = FederationRuntimePlugin.getTemplate( | ||
| compiler, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When composition selects legacy mode for a supported externalized or aliased runtime,
composedEntryOf(compiler)is undefined and this early return preserves all deprecatedFEDERATION_*entries inDefinePlugin. Those builds therefore still rewrite these identifiers—and optimization flags can still alter the supposedly full bootstrap—even though this release says the defines are removed; retain onlyENV_TARGETregardless of the selected mode.Useful? React with 👍 / 👎.