Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
63d2d5e
fix(enhanced): embed runtime for worker chunks
cursoragent Feb 11, 2026
d561514
test(enhanced): skip vm instantiate on esm
cursoragent Feb 11, 2026
4f609f6
fix(enhanced): include context node_modules for tree-shake
cursoragent Feb 11, 2026
062350f
Merge remote-tracking branch 'origin/main' into cursor/module-federat…
ScriptedAlchemy Feb 12, 2026
8ad848f
chore(core): add changeset coverage for pr #4416
ScriptedAlchemy Feb 12, 2026
69ee9af
Merge remote-tracking branch 'origin/main' into cursor/module-federat…
cursoragent Feb 12, 2026
fe30811
chore(enhanced): add changeset
cursoragent Feb 12, 2026
c1941bc
Merge branch 'cursor/module-federation-webworker-bug-09a5' of https:/…
cursoragent Feb 12, 2026
10726a3
chore(enhanced): remove redundant auto changeset
ScriptedAlchemy Feb 12, 2026
0b8c40d
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 14, 2026
db4ee26
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 14, 2026
dd8644c
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 15, 2026
6549633
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 16, 2026
eac467f
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 16, 2026
852fec2
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 19, 2026
e21d55a
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 19, 2026
aa80b54
Merge remote-tracking branch 'origin/main' into cursor/module-federat…
ScriptedAlchemy Feb 24, 2026
6c010fd
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 25, 2026
cef603e
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 25, 2026
68fdc4a
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 26, 2026
5f804be
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 26, 2026
63d4ec6
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 27, 2026
4070f01
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 27, 2026
4c41936
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 28, 2026
361cd65
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Feb 28, 2026
2a70144
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Mar 2, 2026
951150d
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Mar 3, 2026
f0e1f7b
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Mar 5, 2026
77039a6
Merge remote-tracking branch 'origin/main' into cursor/module-federat…
ScriptedAlchemy Mar 9, 2026
ed444e3
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Mar 10, 2026
824470f
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Mar 11, 2026
03ae71d
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Mar 11, 2026
adb898f
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Mar 11, 2026
0fa48f9
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Mar 12, 2026
55bb4fa
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Mar 13, 2026
9f52de9
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Mar 17, 2026
3982eec
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Mar 18, 2026
43b3014
Merge branch 'main' into cursor/module-federation-webworker-bug-09a5
ScriptedAlchemy Mar 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/bright-crabs-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@module-federation/enhanced": patch
---

Fix federation runtime initialization in worker runtimes and ensure
tree-shaking independent builds resolve project-local node_modules.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ class EmbedFederationRuntimeModule extends RuntimeModule {
return null;
}
let found;
if (chunk.name) {
for (const dep of this.containerEntrySet) {
const mod = compilation.moduleGraph.getModule(dep);
if (mod && compilation.chunkGraph.isModuleInChunk(mod, chunk)) {
found = mod as NormalModuleType;
break;
}
for (const dep of this.containerEntrySet) {
const mod = compilation.moduleGraph.getModule(dep);
if (mod && compilation.chunkGraph.isModuleInChunk(mod, chunk)) {
found = mod as NormalModuleType;
break;
}
}
if (!found) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ class EmbedFederationRuntimePlugin {
return;
}

const { moduleGraph, chunkGraph } = compilation;
for (const dep of containerEntrySet) {
const runtimeModule = moduleGraph.getModule(dep);
if (!runtimeModule) continue;
if (!chunkGraph.isModuleInChunk(runtimeModule, chunk)) {
chunkGraph.connectChunkAndModule(chunk, runtimeModule);
}
}

// Mark as embedded and add the runtime module.
runtimeRequirements.add('embeddedFederationRuntime');
const runtimeModule = new EmbedFederationRuntimeModule(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,18 @@ export default class IndependentSharedPlugin {
parentCompiler.outputPath,
outputDirWithShareName,
);
const parentResolve = parentConfig.resolve || {};
const resolveModules = new Set(
Array.isArray(parentResolve.modules)
? parentResolve.modules
: parentResolve.modules
? [parentResolve.modules]
: ['node_modules'],
);
if (parentCompiler.context) {
resolveModules.add(path.join(parentCompiler.context, 'node_modules'));
}

// @ts-ignore webpack version is not the same as the one used in the plugin
const compilerConfig: Configuration = {
...parentConfig,
Expand All @@ -375,6 +387,10 @@ export default class IndependentSharedPlugin {
entry: {
[IGNORED_ENTRY]: this.createEntry(parentCompiler.context),
},
resolve: {
...parentResolve,
modules: Array.from(resolveModules),
},

// 输出配置
output: {
Expand Down
Loading