Skip to content

chore: upgrade to Angular 22.2 - #144

Merged
Aukevanoost merged 1 commit into
mainfrom
chore/angular-22.2
Sep 24, 2026
Merged

Aukevanoost merged 1 commit into
mainfrom
chore/angular-22.2

Conversation

@Aukevanoost

@Aukevanoost Aukevanoost commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Bumps @angular/build and the devkit packages to 22.2. 22.2 reworks the private APIs the federation build uses (Babel → oxc linker/transformer, new cache layer, new watcher), which broke the build in three places:

  • JavaScriptTransformer / Cache signatures — maxThreads moved into the options as maxConcurrency, transformData takes an options object ({ skipLinker }), and Cache no longer takes a namespace.
  • Hash initialization — the transformer now hashes its cache keys with xxhash-wasm, which must be loaded by awaiting initializeHash() first (Angular's own compiler plugin does it in onStart). Without it every build fails with Hash utility must be initialized by awaiting initializeHash() before use, which typecheck doesn't catch. initializeHash isn't exported from @angular/build/private and the exports map only allows . and ./private, so it's loaded by absolute path from @angular/build/package.json — the same module instance the transformer uses. This relies on Angular's internal file layout.
  • SourceFileCache is no longer a Map — the parsed ts.SourceFile cache moved into the TypeScript compilation, so federationSourceFiles drops cache.keys() and uses typeScriptFileCache + referencedFiles only.

Everything else we import from @angular/build still typechecks, and the NG_BUILD_* env replay still finds environment-options.js with the same exports.

pnpm typecheck, pnpm test (256/256) and pnpm build pass; pnpm lint has no errors.

Possible follow-up

22.2 adds a rootFiles option to the compiler plugin that restricts the TypeScript root names (keeping the tsconfig's .d.ts files). It could replace the per-context tsconfig written by write-context-tsconfig.ts (#138). Not needed for this upgrade.

@angular/build 22.2 reworked the private APIs the federation build uses:

- JavaScriptTransformer takes maxConcurrency in its options and an options
  object in transformData; Cache no longer takes a namespace.
- The transformer hashes cache keys with xxhash-wasm, which must be loaded
  via initializeHash() first. It is not exported from @angular/build/private,
  so load the exact module the transformer uses.
- SourceFileCache is no longer a Map of parsed sources; the watch list now
  comes from typeScriptFileCache and referencedFiles only.
@Aukevanoost
Aukevanoost merged commit e83bb7b into main Sep 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant