Skip to content

[0.60.3] --sourcemap-output | enableHermes: false | gradle file | wrong output path #25693

Closed
@HazAT

Description

@HazAT

React Native version: 0.60.3

Steps To Reproduce

  1. react-native init test
  2. cd test/android
  3. Make sure you have these default settings:
project.ext.react = [
    entryFile: "index.js",
    enableHermes: false,  // clean and rebuild if changing
]
  1. ./gradlew assembleRelease --stacktrace
  2. Check content of android/app/build/generated/assets/react/release/index.android.bundle
  3. Check last line, content is: //# sourceMappingURL=index.android.bundle.packager.map

Expected:

//# sourceMappingURL=index.android.bundle.map


So the problem with this is at least twofold.
First I think if hermes is not enabled it shouldn't mess with the --sourcemap-output parameter at all. Reason why this came up is this: getsentry/sentry-react-native#612 (comment)
Hermes apparently needs an intermediate path and messes with this arg which breaks our setup.

At Sentry we try to pick up on this arg to determine the location but, this is not the real location since you move the file there later, see:

react-native/react.gradle

Lines 172 to 175 in 0190c9c

ant.move(
file: jsPackagerSourceMapFile,
tofile: jsOutputSourceMapFile
);

(Same for bundle)

And also, if the reference on the bottom of the file is not correct we cannot load it correctly.

I am not sure how to solve this since just copying instead of moving really doesn't.
If hermes is enabled it seems to work correctly, I am not sure why the source maps and bundle need to go in the intermediate folder tho.

If you know a way how to fix it, I would provide a PR for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugResolution: LockedThis issue was locked by the bot.Tech: HermesHermes Engine: https://hermesengine.dev/

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions