Skip to content

feat: support React Native sourcemaps in sourcemaps upload#735

Merged
abelonogov-ld merged 1 commit into
mainfrom
andrey/sourcemaps-react-native
Jul 10, 2026
Merged

feat: support React Native sourcemaps in sourcemaps upload#735
abelonogov-ld merged 1 commit into
mainfrom
andrey/sourcemaps-react-native

Conversation

@abelonogov-ld

Copy link
Copy Markdown
Contributor

Summary

ldcli sourcemaps upload only discovered web bundles (.js / .js.map), so React Native builds were skipped and the command failed with no .js.map files found. React Native's react-native bundle produces:

  • iOS: main.jsbundle + main.jsbundle.map
  • Android: index.android.bundle + index.android.bundle.map

This broadens the directory walk to also collect .jsbundle(.map) and .bundle(.map) files, via a shared isSourceMapUploadFile helper.

Why this resolves at lookup time (not just passing the filter)

Each map is uploaded under its own name, so its storage key is <version>/<basePath>/main.jsbundle.map. The backend looks up a frame's sourcemap as <frameFileName>.map (mapFileForJS), and React Native frames reference main.jsbundle / index.android.bundle — so the uploaded map matches. The minified bundle is uploaded alongside the map (mirroring how .js is uploaded with .js.map) so the backend can read its sourceMappingURL and resolve columns.

Repro (before)

$ react-native bundle --platform ios --dev false --entry-file index.js \
    --bundle-output ./build/main.jsbundle --sourcemap-output ./build/main.jsbundle.map
$ ldcli sourcemaps upload --app-version 1.0.0 --path ./build --project my-project
failed to find sourcemap files: no .js.map files found. Please double check that you have generated sourcemaps for your app

After this change the same command uploads main.jsbundle / main.jsbundle.map (and the Android equivalents) directly — no renaming needed.

Changes

  • Add sourceMapUploadSuffixes + isSourceMapUploadFile and use it in getAllSourceMapFiles.
  • Accept .jsbundle, .jsbundle.map, .bundle, .bundle.map in addition to .js / .js.map.
  • Update the empty-result error message to reflect the broader set of patterns.

Test plan

  • go test ./cmd/sourcemaps/... passes
  • go build ./cmd/sourcemaps/... and gofmt clean
  • New TestIsSourceMapUploadFile covers web + RN iOS/Android bundles/maps and rejects .css/.css.map/.md
  • New TestGetAllSourceMapFilesReactNative verifies the four RN filenames are discovered and a non-sourcemap file is skipped
  • Existing empty-dir assertion updated to the new message

Made with Cursor

The `sourcemaps upload` command only discovered web bundles (`.js` /
`.js.map`), so React Native builds (`main.jsbundle`(.map) on iOS,
`index.android.bundle`(.map) on Android) were skipped and the command
failed with "no .js.map files found".

Broaden the directory walk to also collect `.jsbundle`(.map) and
`.bundle`(.map) files via a shared `isSourceMapUploadFile` helper. Each
map keeps its own name, so it is stored under the key the backend looks
up for a matching frame (`<fileName>.map`), and the minified bundle is
uploaded alongside it (as with `.js`) so its `sourceMappingURL` and
columns resolve.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abelonogov-ld abelonogov-ld merged commit e41a87f into main Jul 10, 2026
9 checks passed
@abelonogov-ld abelonogov-ld deleted the andrey/sourcemaps-react-native branch July 10, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants