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

add sourceUrl content to source infos for parsed source maps #195

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vzaidman
Copy link

@vzaidman vzaidman commented Jan 28, 2025

While sourceContent is an optional source map field, it is required for certain behaviors since it is the only field that is used to populate #sourceInfos/#sourceInfoByURL that serves as a source-map-to-source-content reference for source maps.

This creates issues with legitimate source maps that omit sourceContent (again, it's an optional field) and provide source urls instead.

E.G. we had this hot reload issue on React Native: facebook/react-native#49069 that was just fixed.

It was caused by the code that checks if source maps are compatible with each other. That code is failing to recognize that the new source map is incompatible with the old, unless sourceContent is provided, thus adding source maps for files instead of replacing them for files with different source code.

Minimum reproduction: https://github.com/vzaidman/simple-hot-reload-website

I don't have the context on what's the full correct solution, but essentially, I think #sourceInfos/#sourceInfoByURL should be populated with the contents of source files fetched from sources if sourceContent is missing. This PR is the initial draft for that.

@bmeurer
Copy link
Contributor

bmeurer commented Jan 28, 2025

Thanks for the patch! Can you please upload the fix via Gerrit, see this part of the Contribution Guide for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants