-
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] Setting --sourcemap-output in extraPackagerArgs in project.ext.react breaks bundling #32239
Comments
In case anyone needs this, until this get fixed (or not), I've made a patch so it can be used with patch-package. Just remember to change
Then you can use
Of course this patch is for 0.65.1 since it's the version I'm using, but since changing sourcemap output path should be broken in older versions as well, this should work as well. |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
This issue was closed because it has been stalled for 7 days with no activity. |
Reopening as there is a pending PR #33703 |
Asking here as it's relevant also for the linked PR: why do you need to change the sourcemap location @taltrui ? |
Hi!, Since our app has a multi-tenant architecture, multiple kind-of-different apps are built from the same code. When we deploy an app, it's sourcemap is uploaded to Rollbar. In Hermes the sourcemap output path is: So to simplify our deploy flow (we use Fastlane to handle this), specifically the custom-made action to upload the sourcemap to Rollbar, having the sourcemap output to be always the same is really helpfull. Without Hermes setting I don't know if there is a better way (or a way at all) to do what I say, but basically that is our use case. |
Could you link to where this custom made action lives? Ideally the action should be updated to handle multiple source maps and we should not bake this configuration inside RN. |
The custom action lives in our repo. It's a really simple ruby fastlane action class that takes a file in a path and uploads it to rollbar with a post request. The action could handle multiple sourcemaps locations, but it is kind of inconvenient. If you really think changing the sourcemap final location by configuration is something that should be out of the responsibility of RN it's OK and we will adapt to it. Since without Hermes it was supported (or at least worked with no problems). seemed logical to me it should or atleast could work with Hermes too. |
In theory, yes. Practically speaking, we're trying to limit the amount of configurable parts to expose only what is really necessary (or what is needed by a significant amount of users). As this can be solved on your action's end, feels like the preferred approach at this stage. |
Please provide all the information requested. Issues that do not follow this format are likely to stall.
Description
Adding
--sourcemap-output
flag toproject.ext.react
config inandroid/app/build.gradle
breaks bundling (withbundleRelease
for example) when Hermes is enabled.This doesn't happen when Hermes is disabled.
Tested on Windows 10 and macOS Big Sur.
React Native version:
Device info
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
npx react-native init
app/build.gradle
extraPackagerArgs: ["--sourcemap-output", "$rootDir/sourcemap.android.js"]
toproject.ext.react
cd android && ./gradlew bundleRelease
Expected Results
AAB is created successfully and sourcemap is created in
android/sourcemap.android.js
Snack, code example, screenshot, or link to a repository:
I think it doesn't make much sense to create a repo since you can reproduce this with the minimum project created by react-native cli.
Just in case, sourcemap is created successfully in the desired path, but react-native seems to have hardcoded the path:
It seems the culprit of this is
react.gradle
Hermes bundling:As you can see here
--sourcemap-output", enableHermes ? jsPackagerSourceMapFile : jsOutputSourceMapFile
,jsPackagerSourcemapFile
is used as default, but can be overridden by*extraArgs
.This isn't a problem per se, but later we see:
Here
jsPackagerSourceMapFile
is used as the only option which is "hardcoded" as:def jsPackagerSourceMapFile = file("$jsIntermediateSourceMapsDir/${bundleAssetName}.packager.map")
.With this:
Bundling works just fine but since I'm not an expert in Gradle and bundling and such things I can't really tell if this is a good solution or just a patch.
The text was updated successfully, but these errors were encountered: