Skip to content

Incorrect extraction of //# sourceMappingURL= when inside a string #3008

@TheYoxy

Description

@TheYoxy

CLI Version

2.58.2

Operating System and Architecture

  • macOS (arm64)
  • macOS (x86_64)
  • Linux (i686)
  • Linux (x86_64)
  • Linux (armv7)
  • Linux (aarch64)
  • Windows (i686)
  • Windows (x86_64)

Operating System Version

macOS Tahoe 26.1, Arch-linux

Link to reproduction repository

No response

CLI Command

sentry sourcemaps inject

Exact Reproduction Steps

Inside some bundled code I have the following code:

... some code
						code$1 += `
//# sourceMappingURL=${map.toUrl()}`;
					}
... more code

For reference, this is some code from unplugin.

Expected Results

Since the line is inside a string template, the line shouldn't be altered.

Actual Results

It removes this the sourceMappingURL line and move it to the end of the file with the generated debug id for the file. Since the end of the string is at the end of the line, it creates a syntax error since there isn't the end of the string.

For reference, when there is multiple reference of this, it only removes the last occurrence of the previous string.

Logs

There is nothing relevant in the logs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIssue typeCLIProduct area

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions