We use crashlytics and it's needed to have a sourcemap of our js file.
It's a problem when running release build, because we just can't pass --sourcemap-output argument to packager. And we forced to use local _react.gradle_ instead of bundled one from node_modules. (Gool ol' copy-paste not welcome)
This bug was introduced by #6610
Commit: a7cde8045ba10d67896cc5b203d397eaf4f395d6
Solution:
Add a boolean flag (_generate source maps?_) into commented-out section before apply from: "../../node_modules/react-native/react.gradle" line and consume it.
Seems like they provide a new way to inject config.
Yeah, @rayshih . Now it's possible to pass additional arguments to packager, by https://github.com/facebook/react-native/commit/1f2027a1fe740b159f120663d6ddb9ca381d48af
Sourcemap argument can be passed like:
project.ext.react = [
extraPackagerArgs: ["--sourcemap-output", "path/to/bundle.js.map"]
]
(However, I didn't tested it, but it should work though)
I think, that this issue is resolved now, and I will close it then.
P.S. Thanks for ping
I just tried it, and it works :)
I can also confirm that it works (tried with v0.29). I'm using the following config in build.gradle to generate the source-map in the same location as the release bundle file:
project.ext.react = [
extraPackagerArgs: ["--sourcemap-output", "$buildDir/intermediates/assets/release/index.android.bundle.map"]
]
apply from: "../../node_modules/react-native/react.gradle"
How can this be done (without resorting to cloning react.gradle locally) when variants are introduced?
@drudge as v0.29 I guess?
Most helpful comment
I can also confirm that it works (tried with v0.29). I'm using the following config in
build.gradleto generate the source-map in the same location as the release bundle file: