Skip to content

fix(metro-serializer-esbuild): enable esbuild sourcemap#389

Merged
tido64 merged 4 commits intomainfrom
tido/esbuild-sourcemap
Jul 12, 2021
Merged

fix(metro-serializer-esbuild): enable esbuild sourcemap#389
tido64 merged 4 commits intomainfrom
tido/esbuild-sourcemap

Conversation

@tido64
Copy link
Copy Markdown
Member

@tido64 tido64 commented Jul 12, 2021

Description

esbuild's sourcemap will be mapped to the transformed JS. Ideally, it should map to the original source code, but since Metro currently handles the transformation, we cannot do that. At least now, it won't be pointing at wrong lines.

Test plan

  1. Build everything up to, and including, @rnx-kit/test-app:
    yarn
    yarn build-scope @rnx-kit/test-app
    
  2. Enable experimental_treeShake:
    diff --git a/packages/test-app/package.json b/packages/test-app/package.json
    index a870cbb..7a3438b 100644
    --- a/packages/test-app/package.json
    +++ b/packages/test-app/package.json
    @@ -68,7 +68,7 @@
             ]
           },
           "typescriptValidation": true,
    -      "experimental_treeShake": false,
    +      "experimental_treeShake": true,
           "targets": [
             "android",
             "ios",
  3. Run yarn bundle+esbuild
  4. Examine dist/main+esbuild.*.jsbundle.map

esbuild's sourcemap will be mapped to the transformed JS. Ideally, it
should map to the original source code, but since Metro currently
handles the transformation, we cannot do that. At least now, it won't be
pointing at wrong lines.
@tido64 tido64 requested a review from kelset July 12, 2021 11:01
@tido64 tido64 requested review from JasonVMo and afoxman as code owners July 12, 2021 11:01
@tido64 tido64 added the feature: metro This is related to Metro label Jul 12, 2021
Base automatically changed from tido/add-experimental-tree-shake to main July 12, 2021 17:25
Co-authored-by: Adam Foxman <adam@thefoxmans.net>
@tido64 tido64 enabled auto-merge (squash) July 12, 2021 17:31
@tido64 tido64 merged commit a131d68 into main Jul 12, 2021
@tido64 tido64 deleted the tido/esbuild-sourcemap branch July 12, 2021 17:36
tido64 pushed a commit that referenced this pull request Mar 30, 2026
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: metro This is related to Metro

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants