-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Android][Hermes][Sourcemaps][Release] Fix for sourcemap-output external configuration breaks bundling #33703
[Android][Hermes][Sourcemaps][Release] Fix for sourcemap-output external configuration breaks bundling #33703
Conversation
Hi @joe-sam! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Base commit: 0337a29 |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Base commit: 0337a29 |
Hey @joe-sam, I'm trying to understand why this is even needed. I would rather allow customizing the sourcemap location rather than doing all the CLI parameter handling you're doing. |
Sorry for the late response @cortinico my internet went down for more than a few days due to inclement weather.
To ensure a smooth and seamless transition I would not introduce a new config option for a minor release such as 0.68.2, as has been done by the patch as millions of devs would miss such a breaking change, until it shows up too late at a maintenance/debug phase on an integration like Sentry or Bugsnag etc. I caught mine more than a month after release after migrating to Hermes and was confounded by the enigmatic stack trace till I stumbled on this issue.
edit |
Thanks for the detailed response @joe-sam, but it still doesn't answer my original point: why is this change even needed in the first place? You should be fine by overriding the sourcemap location instead, rather than manipulating the CLI parameters |
Yes that should work perfectly fine as well ,I misunderstood your original question, and is certainly cleaner implementation. I certainly have no issues if you wish to implement it that way. I was trying to avoid adding in new configurations and use one CLI override for extraPackagerArgs which I assumed was standard behaviour. If I have understood you right then instead of the CLI override, you will now require two extra config objects specifying the intermediate and final paths defined in project.ext.react array for example [config.OutputSourceMapFile, config.PackagerSourceMapFile] defined in project.ext.react one for the which can override the defaults.
and in react.gradle
If this is more on the lines of what you meant I can close this and submit a new PR to resolve the issue. |
You should be fine with:
This allows you to customize the bundle name and the sourcemap filename. Customizing the sourcemap location is not possible at the moment, and I still haven't fully understood what's the use case for it. |
Alright since there is no use case for custom sourcemap location I will close this pull request. |
Summary
This is a fix for the issue Setting --sourcemap-output in extraPackagerArgs in project.ext.react breaks bundling #32239
This bug only affects Hermes with Android on release builds.
Hermes sourcemaps are generated as part of a multistage process for release builds combining the intermediate hbc compiler and packager maps to produce the final bundle map using the compose-sourcemap scripts.
Overriding the sourcemap-output parameter, breaks the intermediate destination of Hermes packager sourcemaps.
This fix corrects the intermediate/final destination for the final sourcemap-output as specified by the user without changing the intermediate destinations permitting the maps to build without a hitch.
Note that
1 the sourcemap-output build destination must pre-exist or be re-generated as part of the usual bundle process.
2 sourcemaps are only generated for release build variants and not other variants.
Changelog
[ANDROID][FIXED][HERMES][RELEASE][SOURCEMAPS] - Setting --sourcemap-output in extraPackagerArgs in project.ext.react breaks bundling
Test Plan
Create a new project with npx react-native init
Enable Hermes in app/build.gradle
Modify the following configuration section to app/build.gradle
run cd android && ./gradlew assemblerelease
Retry with other combinations of enableHermes: false/true and with/without extraPackagerArgs sourcemap-output overrides and check if the source map corresponding to the bundle are generated as expected in the user specified destination override OR in the default build locations when override not specified.