Skip to content

fix(@angular/build): resolve library bundle sourcemap sources relative to output directory - #34238

Open
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix/library-sourcemap-sources
Open

alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix/library-sourcemap-sources

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

In the @angular/build:library builder, Rolldown is invoked with a relative dir ('fesm2022' or 'types'), causing the sources paths in emitted .mjs.map and .d.ts.map files to be computed relative to <cwd>/fesm2022 and <cwd>/types rather than the actual output directory (<outputPath>/fesm2022 and <outputPath>/types).

What is the new behavior?

sourcemapPathTransform is configured to compute sourcemap sources paths relative to the actual output directory.

Does this PR introduce a breaking change?

  • Yes
  • No

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the library builder pipeline to correctly resolve and relativize sourcemap paths for both ESM and DTS outputs. It introduces the outputPath parameter to executeMultiBundle and utilizes sourcemapPathTransform to transform source paths to relative POSIX paths. Additionally, the DTS bundler configuration is updated to use the 'oxc' generator, and corresponding tests are added to verify the correctness of the generated sourcemap paths. I have no feedback to provide.

@alan-agius4
alan-agius4 force-pushed the fix/library-sourcemap-sources branch from b51de76 to 3fc6e40 Compare October 1, 2026 15:26
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: minor This PR is targeted for the next minor release labels Oct 1, 2026
@alan-agius4
alan-agius4 requested a review from clydin October 1, 2026 15:26
@alan-agius4
alan-agius4 force-pushed the fix/library-sourcemap-sources branch from 3fc6e40 to 41217dd Compare October 1, 2026 15:30
…e to output directory

Configure `cwd` and `sourcemapPathTransform` when generating FESM and declaration bundles in the library builder so that emitted sourcemap `sources` entries are computed relative to the actual output directory.
@alan-agius4
alan-agius4 force-pushed the fix/library-sourcemap-sources branch from 41217dd to 88eb30c Compare October 1, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/build target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant