Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing --sourcemap-output to extraPackagerArgs fails to build. #24044

Closed
joshuapinter opened this issue Mar 19, 2019 · 5 comments
Closed

Passing --sourcemap-output to extraPackagerArgs fails to build. #24044

joshuapinter opened this issue Mar 19, 2019 · 5 comments
Labels
Bug Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.

Comments

@joshuapinter
Copy link
Contributor

🐛 Bug Report

I want to generate sourcemaps when running ./gradlew assembleRelease.

I looked into react.gradle and saw that it accepts extraPackagerArgs and passes that to the bundle command.

So I tried passing the --sourcemap-output option in my build.gradle like so:

project.ext.react = [
  extraPackagerArgs: [ "--sourcemap-output", "$buildDir/intermediates/assets/release/index.android.bundle.map" ]
]

But I get the following error when running ./gradlew assembleRelease:

> Task :cntral:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Failed to capture fingerprint of input files for task ':cntral:bundleReleaseJsAndAssets' property '$1' during up-to-date check.
> Failed to create MD5 hash for file '/Users/me/Development/app/tmp/skylight-87084.sock' as it does not exist.

To Reproduce

See above.

Expected Behavior

Generates an APK as well as the sourcemaps.

Environment

$ ./node_modules/.bin/react-native info

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: (24) x64 Intel(R) Xeon(R) CPU           X5690  @ 3.47GHz
      Memory: 7.96 GB / 64.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.11.0 - /usr/local/bin/node
      Yarn: 1.10.1 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 15, 17, 22, 23, 27, 28
        Build Tools: 26.0.0, 28.0.3
        System Images: android-22 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
    IDEs:
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3 
      react-native: 0.57.8 => 0.57.8 
@grabbou
Copy link
Contributor

grabbou commented Mar 20, 2019

I don't think this is related to passing sourceMapOutput flag. Try removing /Users/me/Development/app/tmp/skylight-87084.sock file.

CC: @dulmandakh, you had exact same error with BUCK cache MD5 issue. How did you manage to solve it?

@react-native-bot react-native-bot added Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. Resolution: Old Version labels Mar 20, 2019
@react-native-bot
Copy link
Collaborator

It looks like you are using an older version of React Native. Please update to the latest release, v0.59 and verify if the issue still exists.

The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running `react-native info` on a project using the latest release.

@joshuapinter
Copy link
Contributor Author

@grabbou It's the only thing that I'm changing. If I remove this:

project.ext.react = [
  extraPackagerArgs: [ "--sourcemap-output", "$buildDir/intermediates/assets/release/index.android.bundle.map" ]
]

It runs fine.

Checking the delete of the .sock file now...

@joshuapinter
Copy link
Contributor Author

joshuapinter commented Mar 20, 2019

Weird. So I deleted that .sock file and re-ran. Now I'm getting the following error:

> Task :cntral:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Failed to capture fingerprint of input files for task ':cntral:bundleReleaseJsAndAssets' property '$1' during up-to-date check.
> Could not list contents of '/Users/me/Development/ntwrk/node_modules/.bin/extract-zip'. Couldn't follow symbolic link.

So, ntwrk is a completely different project. Not related to the project I'm working on at all. What's going on that it's looking at these files?

And, to confirm, if I just manually update the react.gradle file and change the following:

"--reset-cache", "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir, *extraArgs)

to

"--reset-cache", "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir, "--sourcemap-output", "./app/build/generated/assets/react/release/index.android.bundle.map", *extraArgs)

It works fine and the sourcemaps are generated.

It's just trying to add the extraPackagerArgs that causes these errors. So you're right, in that, it's not --sourcemap-output related, but instead extraPackagerArgs or project.ext.react related.

Anything else I can try to help diagnose?

Thanks!

@joshuapinter
Copy link
Contributor Author

An update for you. I moved the extraPackagerArgs from the app/build.gradle to the root project's build.gradle file with:

ext {
  react = [
    extraPackagerArgs: [ "--sourcemap-output", "app/build/generated/assets/react/release/index.android.bundle.map" ] // Needed for Bugsnag to decode minimized Javascript.
  ]
}

And it worked fine. So it had to do with trying to add the ext variables in the app's build.gradle.

Anyway, doesn't seem related to react-native so I'm going to close this Issue.

Thanks for looking at it regardless. 👍

@facebook facebook locked as resolved and limited conversation to collaborators Mar 21, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.
Projects
None yet
Development

No branches or pull requests

3 participants