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

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
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
ldcli 3.1.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## [3.1.0](launchdarkly/ldcli@v3.0.4...v3.1.0) (2026-07-10)


### Features

* [FD-5561] implement FDv2 polling endpoint GET /sdk/poll ([#701](launchdarkly/ldcli#701)) ([8a1cda1](launchdarkly/ldcli@8a1cda1))
* [FD-5562] Adding FDv2 Stream endpoint support in the dev server ([#703](launchdarkly/ldcli#703)) ([ff8c116](launchdarkly/ldcli@ff8c116))
* add whoami command ([#657](launchdarkly/ldcli#657)) ([d2cca65](launchdarkly/ldcli@d2cca65))
* support React Native sourcemaps in sourcemaps upload ([#735](launchdarkly/ldcli#735)) ([e41a87f](launchdarkly/ldcli@e41a87f))


### Bug Fixes

* prevent subcommands from showing root-level commands in help output ([#730](launchdarkly/ldcli#730)) ([ca49101](launchdarkly/ldcli@ca49101))
* **REL-13522:** convert kebab-case query params to camelCase ([#705](launchdarkly/ldcli#705)) ([98700e4](launchdarkly/ldcli@98700e4))
* update install-hooks target to use pre-commit install ([#731](launchdarkly/ldcli#731)) ([424147f](launchdarkly/ldcli@424147f))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY --></pre>
  <p>View the full release notes at <a href="https://github.com/launchdarkly/ldcli/releases/tag/v3.1.0">https://github.com/launchdarkly/ldcli/releases/tag/v3.1.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!14012
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