Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: append sourceMappingURL comment to transformed code #10534

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,8 @@

### Fixes

- `[jest-transform]` Fix source mapping of transformed code in the debugger ([#10534](https://github.com/facebook/jest/pull/10534))

### Chore & Maintenance

### Performance
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-transform/src/ScriptTransformer.ts
Expand Up @@ -432,6 +432,9 @@ class ScriptTransformer {
map = typeof instrumented === 'string' ? null : instrumented.map;
} else {
code = transformed.code;
if (map) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we should keep it in the if (map) below, but check if the source code has a sourceMappingURL statement already.

Not sure if we then should replace it with our own or just ignore it?

code += '\n//# sourceMappingURL=' + sourceMapPath;
}
}

if (map) {
Expand Down