Core
The core package — @softarc/native-federation — is the
bundler- and framework-agnostic builder library that sits at the heart
of Native Federation. Every adapter (Angular, esbuild, Vite, …) is
built on top of it.
This section covers the v4 core. For a full overview of what changed since v3 — packages, ESM, repositories — see v3 vs v4.
What the Core Does
Given a federation config and a pluggable bundler adapter, the core library:
-
Resolves and normalizes your
federation.config.js— including shared dependencies, mapped paths, and skip lists. - Bundles every shared external (and, optionally, its secondary entry points) into standalone EcmaScript modules.
-
Bundles every exposed module and every
shared mapped path from your
tsconfig. -
Writes a
remoteEntry.jsondescribing exposes, shared packages and chunks — the contract between host and remote. -
Writes a local
importmap.jsonthat the runtime hands to the browser to wire everything together. - Caches already-built shared dependencies (keyed by checksum) so subsequent builds are fast.
Where It Fits
The core defines two contracts — a federation config (what to share and expose) and a build adapter (how to invoke the bundler) — and lets everything else plug in. For how it relates to the Adapter, Runtime and Orchestrator layers, see the Architecture Overview.
In this section
- Getting Started — install the package and wire it into a build script.
-
federation.config.js— the complete reference for every field, feature flag and tweak. -
Sharing Dependencies —
share,shareAll, secondary entry points, pseudo-treeshaking and the downsides of sharing. -
Build Process — the
federationBuilderlifecycle. - Caching — the content-addressed cache that keeps warm builds fast.
-
Build Adapters — the
NFBuildAdaptercontract, plus Build Your Own Adapter. -
Build Artifacts —
remoteEntry.json, the import map and the cache layout. -
API Reference — the public exports
of
@softarc/native-federation.
If you are building an application (rather than an adapter) you'll usually consume the core through an adapter. The Angular adapter and esbuild adapter both hide the core entirely behind higher-level APIs.