Skip to content

Latest commit

 

History

857 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@angular-architects/native-federation

npm version npm downloads license

The Angular adapter for Native Federation: the mental model of Module Federation, implemented on browser standards (ES modules and import maps) for Micro Frontends and plugin-based architectures.

📖 Documentation

Note

This is v4. Upgrading from an older version? See the migration guide, or run ng update @angular-architects/native-federation. The v3 source lives in the module-federation-plugin repository.

Features

  • Stays on the Angular CLI — delegates to Angular's esbuild-based ApplicationBuilder and dev server, so you keep every CLI optimisation.
  • Web standards — remotes are plain ES modules wired together by an import map.
  • Shared dependencies — load a library once across host and remotes, with semver-aware version negotiation.
  • Schematics — ng add turns a project into a host or remote; ng update migrates it.
  • SSR, Incremental Hydration and I18N — supported out of the box.

Versions

The adapter follows Angular's version numbers: use the adapter release that matches your Angular major and minor (e.g. 22.1.x for Angular 22.1.x).

Your Angular Install
22+ @angular-architects/native-federation
20 – 21 @angular-architects/native-federation-v4

@angular-architects/native-federation-v4 is a bridge package: it brings Native Federation v4 to projects still on Angular 20 or 21. Starting with Angular 22, v4 ships in the main @angular-architects/native-federation package again, so drop the -v4 suffix when you upgrade (ng update @angular-architects/native-federation does this for you).

Quick start

Install the adapter, then make one project a remote and another a host:

npm i @angular-architects/native-federation -D

ng g @angular-architects/native-federation:init --project mfe1 --port 4201 --type remote
ng g @angular-architects/native-federation:init --project shell --port 4200 --type dynamic-host

The schematic points angular.json at the federation builder, moves your bootstrap into bootstrap.ts and generates a federation.config.mjs:

import {
  withNativeFederation,
  fromPackageJson,
} from "@angular-architects/native-federation/config";

export default withNativeFederation({
  name: "mfe1",
  exposes: {
    "./Component": "./projects/mfe1/src/app/app.component.ts",
  },
  shared: fromPackageJson({
    singleton: true,
    strictVersion: true,
    requiredVersion: "auto",
    build: "package",
  })
    // includeSecondaries is an opt-out of ignoreUnusedDeps, so all of
    // @angular/core is shared to prevent mismatches.
    .patch(["@angular/core"], { includeSecondaries: { keepAll: true } }),
  skip: ["rxjs/ajax", "rxjs/fetch", "rxjs/testing", "rxjs/webSocket"],
  features: {
    denseChunking: true,
  },
});

Load the exposed component in the shell like any lazy route, then run ng serve mfe1 and ng serve shell. The Getting Started guide walks through every step, and the playground has runnable hosts, remotes and SSR examples.

Documentation

Using an AI coding assistant? Point it at llms.txt.

Contributing

Issues and pull requests are welcome — see CONTRIBUTING.md.

Credits

Big thanks to Zack Jackson for originally coming up with Module Federation and its mental model, to the Angular CLI team, esp. Alan Agius and Charles Lyding, for the esbuild-based builder this adapter builds on, and to Florian Rappl and the Angular Architects team for their feedback and contributions. Find the current team behind native-federation on our documentation website.

License

MIT

About

No description, website, or topics provided.

Resources

Contributing

Stars

32 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages