esbuild Adapter

@softarc/native-federation-esbuild v3 — the reference build adapter, framework-agnostic, esbuild with a rollup pre-pass for CommonJS packages.

@softarc/native-federation-esbuild is the reference implementation of the core's BuildAdapter contract. It is small on purpose: hand it to federationBuilder.init and the core can bundle exposed modules, shared mappings and shared packages without knowing anything about your framework.

npm i @softarc/native-federation @softarc/native-federation-esbuild

The package exports one ready-made adapter and one factory:

import { esBuildAdapter, createEsBuildAdapter } from '@softarc/native-federation-esbuild';

// zero-config — createEsBuildAdapter({ plugins: [] })
esBuildAdapter;

// configured
const adapter = createEsBuildAdapter({
  plugins: [myEsbuildPlugin()],
  fileReplacements: reactReplacements.prod,
});

How it bundles

Every entry point the core hands over is classified by whether it lives in node_modules:

The pre-pass exists because esbuild alone cannot always convert CommonJS packages that build their exports object dynamically — React being the canonical case. See React & CJS Interop.

Output is written by the adapter itself (esbuild runs with write: false), with [name]-[hash] naming when the core asks for hashing.

In this section