You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Backtrace/react provides CI tooling to easily post source maps to Backtrace. Posting source maps enables Backtrace to symbolicate minified code, allowing error reports to be displayed with the original source code highlighting the correct faulting line.
447
+
448
+
To integrate an application source maps in react-native with Backtrace you need:
449
+
- create a `.backtracejsrc` file in the main application folder,
450
+
- install the `@backtrace/javascript-cli` and `@backtrace/sourcemap-tools` packages,
451
+
- modify `metro.config.js` to attach debug identifier to the generated javascript code,
452
+
- modify the build system in the android or xcode project.
453
+
454
+
#### Modifying `metro.config.js`
455
+
456
+
Backtrace is compatible with the metro build system. To enable source map support, set a `customSerializer` method in the `metro.config.js` file to the `processSourceMap` function available in `@backtrace/react-native/scripts/processSourceMap`.
Add Backtrace to build automation to ensure every build has source map support.
472
+
473
+
In order to upload source maps to Backtrace, you can:
474
+
475
+
**On Android:**
476
+
477
+
Enable source map support in `app/build.gradle` by uncommenting hermes source map flags. With additional parameters, source maps will be generated. To automatically upload them to Backtrace, you can use the gradle task available the @backtrace/react-native library.
Modify the code in the `Bundle React Native code and images` step in the `Build Phases` of your xcode project setting. In the end of the script, you can include the code below, to upload source maps directly to Backtrace after generating the applicaiton.
Backtrace generates `.backtrace-sourcemap-id` in the application build directory. The file contains debug-id attached to each source file and source file. The debug id file path can be modified by setting an environment variable `DEBUG_ID_PATH` to the path to the file. For example:
0 commit comments