Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
18957e7
fix(esbuild): honor absWorkingDir for remote output
ScriptedAlchemy Sep 18, 2026
2037562
Merge branch 'rfc5036/04-runtime-image-cache' into rfc5036/05-esbuild…
ScriptedAlchemy Sep 18, 2026
29643c4
fix(esbuild): honor absWorkingDir for manifest and package.json
ScriptedAlchemy Sep 24, 2026
ee6872c
fix(esbuild): keep the manifest build name lookup unchanged
ScriptedAlchemy Sep 24, 2026
16fa248
docs(esbuild): drop the package.json lookup from the changeset
ScriptedAlchemy Sep 24, 2026
e432fd6
Merge branch 'rfc5036/04-runtime-image-cache' into rfc5036/05-esbuild…
ScriptedAlchemy Sep 24, 2026
e61b3c8
Merge branch 'rfc5036/04-runtime-image-cache' into rfc5036/05-esbuild…
ScriptedAlchemy Sep 24, 2026
e40a3d1
Merge branch 'rfc5036/04-runtime-image-cache' into rfc5036/05-esbuild…
ScriptedAlchemy Sep 24, 2026
30c943c
Merge branch 'rfc5036/04-runtime-image-cache' into rfc5036/05-esbuild…
ScriptedAlchemy Sep 24, 2026
9d4bc5d
Merge branch 'rfc5036/04-runtime-image-cache' into rfc5036/05-esbuild…
ScriptedAlchemy Sep 24, 2026
0fbd176
Merge branch 'rfc5036/04-runtime-image-cache' into rfc5036/05-esbuild…
ScriptedAlchemy Sep 24, 2026
8730779
Merge branch 'rfc5036/04-runtime-image-cache' into rfc5036/05-esbuild…
ScriptedAlchemy Sep 25, 2026
d6e28a0
Merge branch 'rfc5036/04-runtime-image-cache' into rfc5036/05-esbuild…
ScriptedAlchemy Sep 25, 2026
181552c
Merge branch 'rfc5036/04-runtime-image-cache' into rfc5036/05-esbuild…
ScriptedAlchemy Sep 25, 2026
24adb13
Merge branch 'rfc5036/04-runtime-image-cache' into rfc5036/05-esbuild…
ScriptedAlchemy Sep 25, 2026
9f7dc23
Merge branch 'rfc5036/04-runtime-image-cache' into rfc5036/05-esbuild…
ScriptedAlchemy Sep 25, 2026
6e01dc4
Merge branch 'update/rfc5036-04' into update/rfc5036-05
ScriptedAlchemy Oct 3, 2026
59dd906
Merge updated RFC5036 parent into esbuild rollout
ScriptedAlchemy Oct 3, 2026
92d892a
Merge validated RFC5036 Node payload boundary fix
ScriptedAlchemy Oct 3, 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
8 changes: 8 additions & 0 deletions .changeset/esbuild-full-runtime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@module-federation/esbuild': patch
---

Resolve the generated remote entry and the `mf-manifest.json` output path
from esbuild's `absWorkingDir` instead of `process.cwd()`. Keep the adapter on
the full default bundler runtime and test the public build path without
resolver or process-directory overrides.
128 changes: 128 additions & 0 deletions packages/esbuild/__tests__/full-runtime.spec.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import assert from 'node:assert/strict';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import test from 'node:test';
import { build } from 'esbuild';
import { moduleFederationPlugin } from '../dist/plugin.mjs';

const packageDir = path.resolve(import.meta.dirname, '..');

test('the public plugin bundles the full default runtime', async () => {
const root = fs.mkdtempSync(path.join(packageDir, '.mf-esbuild-runtime-'));
fs.writeFileSync(path.join(root, 'entry.js'), 'export const host = true;\n');
fs.writeFileSync(path.join(root, 'value.js'), 'export const value = 42;\n');

try {
const result = await build({
absWorkingDir: root,
bundle: true,
entryPoints: ['entry.js'],
external: [
'@module-federation/error-codes',
'@module-federation/runtime',
'@module-federation/sdk',
],
format: 'esm',
metafile: true,
outdir: 'dist',
plugins: [
moduleFederationPlugin({
name: 'esbuild_runtime_test',
filename: 'remoteEntry.js',
exposes: { './value': './value.js' },
remotes: {},
shared: {},
}),
],
});
const inputs = Object.keys(result.metafile.inputs);

assert(
inputs.some((input) =>
input.endsWith('/webpack-bundler-runtime/dist/index.js'),
),
'the public plugin did not include the bundler runtime',
);
assert(
inputs.some((input) => input.endsWith('/dist/initContainerEntry.js')),
'the full runtime omitted container initialization',
);
assert(
inputs.some((input) => input.endsWith('/dist/remotes.js')),
'the full runtime omitted remote loading',
);
assert(
inputs.some((input) => input.endsWith('/dist/consumes.js')),
'the full runtime omitted shared consumption',
);
const remoteOutput = Object.keys(result.metafile.outputs).find(
(output) => path.basename(output) === 'remoteEntry.js',
);
assert.equal(
remoteOutput ? path.basename(path.dirname(remoteOutput)) : '',
'dist',
'the plugin did not emit the configured remote entry',
);
} finally {
fs.rmSync(root, { recursive: true, force: true });
}
});

test('the plugin rewrites the module map and writes the manifest under absWorkingDir', async () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'mf-esbuild-manifest-'));
fs.writeFileSync(path.join(root, 'entry.js'), 'export const host = true;\n');
fs.writeFileSync(path.join(root, 'value.js'), 'export const value = 42;\n');

const strayManifest = path.join(packageDir, 'dist', 'mf-manifest.json');
fs.rmSync(strayManifest, { force: true });

try {
await build({
absWorkingDir: root,
bundle: true,
entryPoints: ['entry.js'],
external: [
'@module-federation/error-codes',
'@module-federation/runtime',
'@module-federation/sdk',
'@module-federation/webpack-bundler-runtime',
],
format: 'esm',
metafile: true,
outdir: 'dist',
plugins: [
moduleFederationPlugin({
name: 'esbuild_manifest_test',
filename: 'remoteEntry.js',
exposes: { './value': './value.js' },
remotes: {},
shared: {},
}),
],
});

const remoteEntry = fs.readFileSync(
path.join(root, 'dist', 'remoteEntry.js'),
'utf-8',
);
assert(
!remoteEntry.includes('__MODULE_MAP__'),
'remoteEntry.js still contains the unresolved module map placeholder',
);

const manifestPath = path.join(root, 'dist', 'mf-manifest.json');
assert(
fs.existsSync(manifestPath),
'mf-manifest.json was not written under absWorkingDir',
);

assert(
!fs.existsSync(strayManifest),
'mf-manifest.json leaked into the package directory instead of absWorkingDir',
);
} finally {
fs.rmSync(root, { recursive: true, force: true });
fs.rmSync(strayManifest, { force: true });
}
});
Loading