Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate/ find the source map file #5

Closed
1 of 4 tasks
jessieAnhNguyen opened this issue Aug 3, 2020 · 1 comment · Fixed by #6
Closed
1 of 4 tasks

Generate/ find the source map file #5

jessieAnhNguyen opened this issue Aug 3, 2020 · 1 comment · Fixed by #6
Assignees
Labels

Comments

@jessieAnhNguyen
Copy link
Member

jessieAnhNguyen commented Aug 3, 2020

Suggestions from Ram:

  1. Check if Dev mode or Prod Mode: 1 of 2 ways
  • Check if metro is running
  • Download bundle file on the device from APP_DIR/assets, and check if this file is minified (better option).
  1. Generate source maps using react-native bundle --minify={isProdMode}: 1 of 2 ways
  • ExecSync Out
  • require('react-native') and then generate the source map
@jessieAnhNguyen
Copy link
Member Author

jessieAnhNguyen commented Aug 9, 2020

Change of plan, the tool just works for Dev mode only (since we can't do adb shell run-as in Prod mode)

  • Add a flag --generate-source-map, in which case
    • If metro server is running, get bundle and source maps from running metro server, and store in os.tmpDir()
    • If metro server is not running, run the command react-native bundleand store the bundle and source map in os.tmpDir()

If there's no flag, proceed in 2 steps:

  • Find the source map from local development machine,

    • If the CLI is generating a bundle in debug mode, the bundle will exist
    • Directory android/app/build/generated/sourcemaps/react/debug/index.android.bundle.map OR android/app/build/intermediates/sourcemaps/react/debug/index.android.bundle.packager.map
  • Request the bundle from running server

    • Make a request to the URL, http://${IP_ADDRESS}:${DEBUG_SERVER_PORT}/${MAP_FILE_NAME}?platform=${PLATFORM}&dev=true
    • Get the source map file and store it in the os.tmpDir()

If both steps above failed:
- Instruct them how to get source map: turn bundleInDebug: true on build.gradle
- Run without source maps

@jessieAnhNguyen jessieAnhNguyen linked a pull request Aug 10, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant