react / react/metro

documentation request: sourcemap format in ram-bundle mode

Open
#347 2 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5.6k
Forks
696
Avg merge
8m
Merged PRs (30d)
7

Description

Hi to the Metro team!

I have an issue with understanding source maps produced by Metro, and AFAIU the technical details are not covered in docs.

Could someone enlighten me what the purpose of the custom FB extensions in source maps produced by ram-bundle command is?

As far as I can see, in a source map object, there are custom properties: x_facebook_offsets and x_metro_module_paths...

https://github.com/facebook/metro/blob/ae75219c279b8a9eaac8e22f32a5ac3403e6e31e/packages/metro-source-map/src/source-map.js#L29-L30

...which are used in advanced bundling modes (as seen from this test): https://github.com/facebook/metro/blob/7dbc6824c2a1e451fa005df77f961c7e11db1a33/packages/metro/src/ModuleGraph/output/__tests__/indexed-ram-bundle-test.js#L92

What concerns me most, has the Source Map v3 spec (https://sourcemaps.info/spec.html) failed to cover your developer needs in the File RAM bundle scenario? Why did you have to add custom information over it, and do these x_* extensions mean that on practice standard tools (source map viewers, error stack resolvers) cannot leverage debug symbols from the source maps produced by ram-bundle command for Android?

To be more specific, I'm having an issue with sentry.io that stopped showing original error stack traces after a switch to ram-bundle (due to noticeable performance improvements from the latter). I'm desperately trying to figure out on which side the problem is and what can be done to fix it - is it us, is it Sentry, is it Metro or all above?

Thanks in advance.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/metro-source-map/src/source-map.js and the indexed RAM bundle test at packages/metro/src/ModuleGraph/output/tests/indexed-ram-bundle-test.js. Compare those custom properties with the Source Map v3 specification and the file RAM bundle documentation. Done means documenting the extensions, their purpose, and the implications for source-map consumers such as Sentry.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
devtools, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.