ds300/react-native-typescript-transformer

What is the right way to extract source maps?

alexmbp opened this issue · 1 comments

Hi there! I need a way to extract source maps for production build. To have good crash reporting. What is the right way to do it?

One way is to run this in your project's root directory:

react-native bundle \
  --dev false \
  --platform ios \
  --entry-file index.js \
  --bundle-output deleteme.jsbundle \
  --sourcemap-output index.map

Press enter, and go grab a cup of coffee.

Some notes:

  • --dev false ensures you cut a production build. metro will shake out unneeded imports and remove if (__DEV__) chunks o' code
  • --platform ios has a android option too
  • --entry-file index.js is the default entry point... if you've changed this manually you'll know
  • --bundle-output is the giant js file that gets embedded in your app ... for straight up source map output (like what you're asking for), this is a byproduct you can delete (hence the name)
  • --source-output finally what you're looking for!! heads up, there are different maps for ios and android (exactly why, i'm not sure), so mind the file name so you don't clobber yourself.