-
Notifications
You must be signed in to change notification settings - Fork 49.8k
Closed
Description
DevTools hooks name parsing code currently assumes a single "source" for the source map:
react/packages/react-devtools-extensions/src/parseHookNames.js
Lines 428 to 434 in ed6c091
| // Now that the source map has been loaded, | |
| // extract the original source for later. | |
| const source = sourceMapContents.sources[0]; | |
| const originalSourceCode = sourceConsumer.sourceContentFor( | |
| source, | |
| true, | |
| ); |
But as pointed out by comment #21641 (comment):
If the compiled code is a bundle, it can consist of multiple modules - what guarantees that
sources[0]is the correct module for the hook we'll be looking up? TheoriginalPositionForcall infindHookNamesabove returns asourceproperty which we currently ignore; I think the correct thing to do is to lazily parse/cache the source at that point rather than make this assumption here.