Version: @angular-architects/native-federation 22.0.6, Angular 22.0.7, Nx workspace, esbuild builder (native-federation:build with vite dev server).
Symptom: When a workspace library that is a shared mapping (tsconfig path, e.g. @apex/shell → libs/shell/src/index.ts) is edited while ng serve/nx serve is running, the emitted shared bundle (_apex_shell.js) keeps serving the old code until the dev server is restarted. A hard browser reload does not help.
Root cause (two gaps in src/builders/build/builder.js):
The shared-mapping source directories are never added to the NF file watcher. syncNfFileWatcher relies on bundlerCache.keys(), but in this setup the cache map stays empty (verified by instrumenting syncNfFileWatcher: total 0, watched 0), so the sync is a silent no-op. Since mappings are externals for the app build, Angular's own watcher doesn't cover them either — nothing ever lands in the dirty buffer, so SourceFileCache is never invalidated and ctx.rebuild() reuses the stale TS output.
Even when a watched file changes, the rebuild loop is only woken for npm-linked dirs (if (isUnderLinkedDir(p)) notifyChange()); workspace-mapping edits are expected to "ride the next Angular-driven rebuild", which never comes for external sources.
Fix (patch below): add the mapping entry-point directories to the NF watcher, and wake the rebuild loop for every watched change. With the patch, a lib edit lands in the shared bundle in ~4s (verified by appending/removing a probe export to the mapping entry while the dev server runs).
Version: @angular-architects/native-federation 22.0.6, Angular 22.0.7, Nx workspace, esbuild builder (native-federation:build with vite dev server).
Symptom: When a workspace library that is a shared mapping (tsconfig path, e.g. @apex/shell → libs/shell/src/index.ts) is edited while ng serve/nx serve is running, the emitted shared bundle (_apex_shell.js) keeps serving the old code until the dev server is restarted. A hard browser reload does not help.
Root cause (two gaps in src/builders/build/builder.js):
The shared-mapping source directories are never added to the NF file watcher. syncNfFileWatcher relies on bundlerCache.keys(), but in this setup the cache map stays empty (verified by instrumenting syncNfFileWatcher: total 0, watched 0), so the sync is a silent no-op. Since mappings are externals for the app build, Angular's own watcher doesn't cover them either — nothing ever lands in the dirty buffer, so SourceFileCache is never invalidated and ctx.rebuild() reuses the stale TS output.
Even when a watched file changes, the rebuild loop is only woken for npm-linked dirs (if (isUnderLinkedDir(p)) notifyChange()); workspace-mapping edits are expected to "ride the next Angular-driven rebuild", which never comes for external sources.
Fix (patch below): add the mapping entry-point directories to the NF watcher, and wake the rebuild loop for every watched change. With the patch, a lib edit lands in the shared bundle in ~4s (verified by appending/removing a probe export to the mapping entry while the dev server runs).