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 infinite recursion when merge sourcemaps #14274

Merged
merged 3 commits into from Feb 15, 2022

Conversation

jridgewell
Copy link
Member

@jridgewell jridgewell commented Feb 15, 2022

Q                       A
Fixed Issues? Fixes #14273
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

If the input map contains a source file that resolves to the same location as input map, then we'd hit an infinite recursion when attempting to build the source map tree.

@babel-bot
Copy link
Collaborator

babel-bot commented Feb 15, 2022

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/51297/

@JLHwung JLHwung added area: sourcemaps i: regression PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels Feb 15, 2022
@nicolo-ribaudo nicolo-ribaudo merged commit 42c765b into babel:main Feb 15, 2022
@jridgewell jridgewell deleted the remapping-infinite branch February 15, 2022 22:27
jridgewell added a commit to ampproject/remapping that referenced this pull request Feb 16, 2022
It's important to know both the importer and the depth of the sourcemap tree when loading, to
solve cases like babel/babel#14274. Here, a parent sourcemap contains a
source location that, when resolved, has the same location as the parent. This easily happens when
the file represents an in-place transformation of the original sourcemap (eg, `babel script.js
--out-file script.js --source-maps`). Because they exist in the same location, it's extremely easy
to create a loader which continues to return the transformed sourcemap when we intend to only return
a `null` (no sourcemap) for the original source file.
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 18, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: sourcemaps i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: "RangeError: Maximum call stack size exceeded" error (v7.17.2 -> v7.17.3)
4 participants