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: Handling source maps without sourcesContent #15445

Merged
merged 2 commits into from Feb 20, 2023

Conversation

liuxingbaoyu
Copy link
Member

@liuxingbaoyu liuxingbaoyu commented Feb 20, 2023

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

ref: #15022

@nicolo-ribaudo @JLHwung This seems to be a regression affecting quite a few people, let's release a patch, thanks!

@liuxingbaoyu liuxingbaoyu added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: generator area: sourcemaps i: regression labels Feb 20, 2023
@babel-bot
Copy link
Collaborator

babel-bot commented Feb 20, 2023

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

@@ -58,7 +58,7 @@ export default class SourceMap {
setSourceContent(
map,
resolvedSources[i],
this._inputMap.sourcesContent[i],
this._inputMap.sourcesContent?.[i],
Copy link
Member

Choose a reason for hiding this comment

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

Nit: We can skip this full loop if there's no sourcesContent.

Copy link
Member Author

Choose a reason for hiding this comment

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

Does this affect sources? At first I skipped the whole loop, but then I'm not sure if sources will be preserved.

Copy link
Member

Choose a reason for hiding this comment

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

Instead of eagerly adding all sources, it'll only adds source as they are marked. It's not important to keep a source that was input if that source is never seen in the map, but setting a sourcesContent forces it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks!

@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 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2023
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 pkg: generator 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]: generating source maps fails due to sourcesContent being undefined
4 participants