Minified code gives wrong line of code
See original GitHub issueHi there,
I tried out the transformer and it works perfect in dev mode, so first: thanks a lot for that 😃 👍
Nonetheless: When not running in debug mode and let the code crash somewhere, the lines and colums are a little bit off.
Steps to reproduce (I forked git clone https://github.com/cbrevik/react-native-typescript-starter and did some changes to illustrate the problem):
https://github.com/hffmnn/react-native-typescript-starter
cd react-native-typescript-starter
git checkout --track origin/feature/ts_map
yarn
yarn bundle:ios:release
Open the iOS project with Xcode and press run.I modified:
index.tsx
to crash after 3 seconds- the Xcode scheme to run in
Release
mode - the Xcode Build Phase to not start the bundling.
The app will crash. Press continue until Xcode spits out something useful like:
Exception: Can't find variable: doSomethingStupid, stack:
<unknown>@365:441
callTimer@31:626
callTimers@31:1010
value@29:2893
<unknown>@29:832
value@29:2294
value@29:804
Run
./symbolicate.js ios/main.jsbundle.map 365 441
Expected:
The output is: <some_user_specific_path>/react-native-typescript-starter/src/index.tsx:19
Experienced:
The output is: <some_user_specific_path>/react-native-typescript-starter/src/index.tsx:13
(Note the difference in the line number)
To verify that it has something to do with dev mode or maybe minify:
- Delete the app from simulator!!!
- Clean the Xcode project!!!
- Run
yarn bundle:ios:dev
- Rerun the application
Experienced:
The output is (as expected): <some_user_specific_path>/react-native-typescript-starter/src/index.tsx:19
I already verified, that the generated sourcemaps for JS based projects (so e.g. a default RN project) work in dev and release mode, so this issue is only valid for how we create the source maps for TS.
I already checked the docs for source-map
(https://www.npmjs.com/package/source-map) but could not find any hint, why that should not work.
Any ideas what else might be the problem?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:9 (5 by maintainers)
Top GitHub Comments
Metro issue over here https://github.com/facebook/metro-bundler/issues/10 🤞
Cool beans. I’m gonna close this. Thanks @quincycs and @skellock