Skip to content

fix(builder): report a federation output path once when it is written twice - #196

Merged
Aukevanoost merged 2 commits into
mainfrom
fix/dedupe-written-outputs
Oct 28, 2026
Merged

Aukevanoost merged 2 commits into
mainfrom
fix/dedupe-written-outputs

Conversation

@Aukevanoost

Copy link
Copy Markdown
Contributor

Fixes #195.

With @angular/build 22.2.5 and source maps on, which includes the development config and ng serve, building a remote failed:

NFBuildAdapter.build returned two results for entry 'app.component.css.map'

22.2.5 also bundles an empty external stylesheet, so a component with inline styles and an empty styleUrl emits two app.component.css.map outputs. writeOutputs flattens both to the same path and returned a result for each. Since the adapter sets entry (#189), core rejects the duplicate.

writeOutputs now reports each written path once, keeping the result for the file the last write left on disk. No Angular internals are involved.

Testing

  • New spec: two outputs with the same basename produce one result, and the last contents are written. It fails without the fix.
  • pnpm typecheck, pnpm test (457 passing) and pnpm lint pass.
  • Manual: angular-examples/angular/simple on @angular/build 22.2.5. ng build mfe1 -c development and a production build with sourceMap: true fail without the fix and pass with it.

#194 touches the same file, so whichever lands second needs a small rebase.

… twice (#195)

@angular/build 22.2.5 also bundles an empty external stylesheet, so a component
with inline styles and an empty styleUrl emits two `<name>.css.map` outputs.
writeOutputs flattens both to the same path and returned a result for each;
since the adapter sets `entry`, core rejects two results for one name and the
build fails whenever source maps are on (including `ng serve`).
@Aukevanoost
Aukevanoost merged commit b8047ec into main Oct 28, 2026
1 check passed
@Aukevanoost
Aukevanoost deleted the fix/dedupe-written-outputs branch October 28, 2026 10:36
Aukevanoost added a commit that referenced this pull request Oct 28, 2026
Backports 22.2.3..22.2.4 onto the Angular 21 layout.

Incoming:
- #167/#169: the dev server keeps federation externals out of the
  stylesheet build; Angular's ssr/prerender corrections reach serveWithVite.
- #166/#168: context tsconfigs pass `types` resolved instead of widening
  typeRoots.
- #173/#176/#186/#200: i18n translates every federation output, honours
  outputPath.browser, stays under the Windows command line limit, inlines
  the source locale only when requested and refreshes integrity hashes.
- #187/#190: optional-peer entry points are skipped only when the peer is
  missing; @angular/localize is an optional peer.
- #189/#195/#196: federation build results carry their entry; a path
  written twice is reported once.
- #194: @softarc/native-federation ~4.9.0, orchestrator ^4.9.0.

Angular 21 specific adaptations:
- Checked the #167/#169 assumptions against @angular/build 21.2.24:
  serveWithVite reads externalDependencies and ssr back from the options it
  passed, and the stylesheet bundler uses externalDependencies, as on 22.
- No // upstream: tags change (still angular-cli v21.2.19, 1a728258d6).
- Skipped #188/#198 (remote builder): this branch has no remote builder.
- Kept the internal builder without instrumentForCoverage; dropped it from
  the incoming spec.
- Moved output-entries and the i18n integration spec into src/utils.
- Skipped the `types: ["*"]` spec below TypeScript 6 (branch is on 5.9).
- @angular/localize optional peer/devDependency at >=21.2.0/^21.2.0.
- Kept the -v4 name, 21.2.16 version, ng21 pins and this branch's global
  pnpm overrides; main's vite 8 override doesn't apply to 21.2's vite 7.
- pnpm-lock.yaml regenerated rather than merged.
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.

Build fails with duplicate 'app.component.css.map' results on @angular/build 22.2.5 with source maps

1 participant