Skip to content

Conversation

@vzaidman
Copy link
Contributor

@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.

@bmeurer bmeurer closed this May 9, 2025
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.

3 participants