Preserve original identifier names from input sourcemaps#17992
Merged
Conversation
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/61524 |
|
commit: |
JLHwung
approved these changes
May 12, 2026
Contributor
JLHwung
left a comment
There was a problem hiding this comment.
The updated source map makes more sense, thank you!
nicolo-ribaudo
approved these changes
May 13, 2026
Member
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
Thanks! If you also need this in Babel 7, please open a PR backporting the commit targeting the 7.x branch.
JLHwung
pushed a commit
that referenced
this pull request
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the issue that caused the original names from the input source map to be ignored by Babel. This caused incorrect mappings to be generated (generating name entries for identifiers coming from the already partially transformed input) and ultimately leading to issues in devtools, such as this:

Notice how
root(from the original source code) can't be evaluated properly here. That's because Babel generatedroot2at this position (that came from the B inA_original -> B -> C_babel_output).I think it might be helpful to review the diff between current and new behavior here: https://github.com/babel/babel/compare/3b6c1f87be19ab3f823fe9c0074006d97c677d32..ea7fa30d663f7d646d3be7cffab50caed3bf84dc