download correct sourceMap for dev/prod profiles, add warning for Expo Dev menu profiles #1833
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #1831
Summary:
As described over in #1831, until now the
profile-hermescommand would always load thedevmode soureMaps, even if a production build was being profiled - this lead to wrong line numbers (at best).This PR detects if the profile has been recorded with a
devorprodbuild, which platform was used and ifminifywas enabled.Unfortunately, at this point, something further down the line seems to fail with a profile that was produced for a minifed build, so I could not really test that - that seems to be some problem with the general process and not with my changes, though.
With
minify: false, I verified this to work correctly for bothdev=trueanddev=false.If no URL information is present in the profiler, the PR just defaults to the values that were in the code before this change.
This PR also adds a warning if no URL information is present, but the profile contains calls to
EXDevMenuApp. That is usually the case when the profiler does not record the user application, but the Expo dev menu. In that case, the user has to reload their app a few times before recording another profile - Hermes always profiles the JS bundle that was loaded last. I'm adding this warning because this is documented nowhere else, and it cost me a day until I found this out for myself.Test Plan:
Record Profiles with different combinations of "DEV" and "minify" selected in the settings reachable from the React Native Dev menu, call
npx react-native profile-hermes --verboseafter each recording and compare the resulting profile line numbers with the actual source code.