Skip to content

[Bug]: extractSourceMap falsely matches on sourceMappingURL inside template literal #15950

Closed

Description

@jadenPete

System Info

System:
  OS: Linux 7.0 Ubuntu 24.04.5 LTS (Noble Numbat)
  CPU: (28) x64 13th Gen Intel(R) Core(TM) i7-13850HX
  Memory: 35.32 GB / 62.44 GB
  Container: Yes
  Shell: 5.2.21 - /bin/bash
Binaries:
  Node: 22.14.0 - /usr/bin/node
  npm: 10.9.2 - /usr/local/bin/npm
  pnpm: 10.33.3
  Deno: 2.2.10 - /usr/local/bin/deno
Browsers:
  Chrome: 154.0.8037.92
npmPackages:
  @rspack/cli: catalog: => 2.2.1
  @rspack/core: catalog: => 2.2.1

Details

rspack emits warnings like these:

WARNING in ⚠ Failed to parse source map from '<REDACTED>/bazel-out/linux_amd64_gnu-fastbuild/bin/node_modules/.aspect_rules_js/@angular+platform-browser@226932862_1032586265/node_modules/@angular/platform-browser/fesm2022/${resolvedSourceMapUrl}' file: Rspack FS Error: IO error: failed to open file `<REDACTED>/bazel-out/linux_amd64_gnu-fastbuild/bin/node_modules/.aspect_rules_js/@angular+platform-browser@226932862_1032586265/node_modules/@angular/platform-browser/fesm2022/${resolvedSourceMapUrl}`: No such file or directory (os error 2)

because it gets tripped up by this expression in Angular's source code:
https://github.com/angular/angular/blob/73858905a277fe2938efff030a686a61c3a38fab/packages/platform-browser/src/dom/dom_renderer.ts#L156

Reproduce link

No response

Reproduce Steps

We're running rspack through a complex Bazel pipeline in our internal monorepo that isn't easy to reproduce. However, running rspack with extractSourceMap enabled on the Angular code I linked above should reproduce the issue. If that doesn't work or a better minimum reproducibility case is desired, let me know.

Activity

  1. added theissue type on Oct 1, 2026
  2. Tiancheng-Xu commented on Oct 6, 2026

    @Tiancheng-Xu
    Contributor

    I'd like to work on this. I'll reduce the Angular case to a standalone fixture and add regression coverage that distinguishes template-literal text from actual source-map comments.

  3. chenjiahan commented on Oct 6, 2026

    @chenjiahan
    Member

    @Tiancheng-Xu thank you!

  4. Tiancheng-Xu commented on Oct 6, 2026

    @Tiancheng-Xu
    Contributor

    I've implemented the source-map comment filtering fix and regression coverage in my fork: https://github.com/Tiancheng-Xu/rspack/tree/fix/source-map-template-literal

    The upstream PR is #15969. It's awaiting review and approval for the fork's CI workflows.

  5. jadenPete commented on Oct 8, 2026

    @jadenPete
    Author

    Thank you! I look forward to this being merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions