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

feat: Document RAM bundles support #996

Merged
merged 5 commits into from
May 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions __tests__/__snapshots__/documentation.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ Array [
"clients/react-native/expo/index.html",
"clients/react-native/index.html",
"clients/react-native/manual-setup/index.html",
"clients/react-native/ram-bundles/index.html",
"clients/react-native/sourcemaps/index.html",
"clients/ruby/breadcrumbs/index.html",
"clients/ruby/config/index.html",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Currently we only support mixed stack traces on iOS. By default this feature is
- [Using Sentry with CodePush]({%- link _documentation/clients/react-native/codepush.md -%})
- [Source maps for Other Platforms]({%- link _documentation/clients/react-native/sourcemaps.md -%})
- [Setup With CocoaPods]({%- link _documentation/clients/react-native/cocoapods.md -%})
- [Using RAM Bundles]({%- link _documentation/clients/react-native/ram-bundles.md -%})
- [Manual Setup]({%- link _documentation/clients/react-native/manual-setup.md -%})
- [iOS]({%- link _documentation/clients/react-native/manual-setup.md -%}#ios)
- [Android]({%- link _documentation/clients/react-native/manual-setup.md -%}#android)
33 changes: 33 additions & 0 deletions src/collections/_documentation/clients/react-native/ram-bundles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: 'Using RAM Bundles'
---

The [RAM bundle](https://facebook.github.io/react-native/docs/performance#ram-bundles-inline-requires) format is a new approach to packaging React Native apps that optimizes your app's startup time. With RAM bundles, it is possible to load to memory only those modules that are needed for specific functionality, and only when needed.

All the existing RAM bundle formats are explained in detail in the [Metro Bundler documentation](https://facebook.github.io/metro/docs/en/bundling).

## Enabling RAM Bundles

To enable RAM bundles for your app, please consult with the [official React Native documentation](https://facebook.github.io/react-native/docs/performance#enable-the-ram-format).

If you use the official `react-native-sentry` integration of version `0.43.1` or newer, no additional actions are required. `sentry-cli`, which is used internally by the integration, will detect the bundle type automatically, and then upload the extracted modules to Sentry.

## Uploading Bundles Manually

Starting from version `1.43.0`, `sentry-cli` provides two additional parameters to the `upload-sourcemaps` command in order to simplify bundle uploads: `--bundle` and `--bundle-sourcemap`. Using those parameters, you can pass the path to the application bundle, along with its source map, and the bundle will be automatically extracted before the upload, if necessary:

```sh
sentry-cli releases files RELEASE_ID upload-sourcemaps --bundle main.bundle --bundle-sourcemap main.bundle.map
```

All bundle types (plain, Indexed RAM bundles, and File RAM bundles) are supported.

## RAM Bundles and Performance

The initial Sentry support for RAM bundles, added in `sentry-cli 1.43.0` and `react-native-sentry 0.43.1`, is known to have an upload performance issue when handling RAM bundles with a large number of modules. This will be fixed in future client versions.

By default, when running as part of Xcode build step (normally called "Bundle React Native Code And Images"), `sentry-cli` uploads source maps to Sentry in the background. To make it run in the foreground and track its progress, you can add `--force-foreground` parameter to the `sentry-cli` command in your Xcode project configuration file `project.pbxproj`, so the command looks similar to:

```sh
./node_modules/@sentry/cli/bin/sentry-cli react-native xcode --force-foreground ../node_modules/react-native/scripts/react-native-xcode.sh
```