#Source maps for React Native Web

3 messages · Page 1 of 1 (latest)

versed rivet
#

My crashes in the Expo Web version of my app do not have source maps, but the crashes in the Expo Android and iOS do. Is there an extra step I need to get unminified code in the Web version?

frail fjordBOT
#

Hi @versed rivet. I'm happy to dig into this for you! I'll check my internal sources for answers to your question! :wave:

#

Yes, there is an extra step needed to get source maps working for the web version of your Expo app. While source maps for iOS and Android are handled automatically, web source maps require additional configuration.

Based on the information from several issues, here's what you need to do:

  1. When exporting your web build, make sure to include the --dump-sourcemap flag:
npx expo export --platform web --dump-sourcemap
  1. After exporting, upload the source maps using the sentry-expo-upload-sourcemaps tool:
SENTRY_PROJECT=your-project \
SENTRY_ORG=your-org \
npx sentry-expo-upload-sourcemaps dist

If you're using Expo Router with bundle splitting, this might be causing issues with your source maps. You can disable bundle splitting for web by setting asyncRoutes.web to false in your expo-router configuration:

plugins: [
  [
    'expo-router',
    {
      asyncRoutes: {
        web: false, // SET THIS TO FALSE
        default: 'development',
      },
    },
  ],

It's also worth noting that source maps are not uploaded for development/debug builds, as mentioned in this issue. Sentry symbolicates the stack trace locally on your computer during development.

If you're still having issues, check if your web bundle contains a Debug ID polyfill (starts with var _sentryDebugIds={}) and if your source map contains a debugId key. These are necessary for proper source map association.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: