Debugging React Native TypeScript in IDEA
Hi
I'm currently struggling with setting up IntelliJ IDEA for a React Native project using TypeScript. I can compile the .ts and .tsx files to .js files and the generated source mapping files also seem to point to the right directory. However, I can not get the debugger to break in the TypeScript files but only in the compiled JavaScript files. You have a guide for setting up aReact Native project in WebStorm (https://blog.jetbrains.com/webstorm/2016/12/developing-mobile-apps-with-react-native-in-webstorm/), but I find it hard to find information about how to setup IDEA with TypeScript for aReact Native project.
I hope you can help me out and please let me know if you need any information about my setup :)
Best regards
Jens
Please sign in to leave a comment.
As it's written in http://www.reactnative.tools/tutorials/2016/09/20/reactnative-ts/, you need using
react-native-sm-transformerto add sourcemaps to the bundle. But this requires passing--transformeroption to react-native 'start' command that is not currently possible:( Please follow https://youtrack.jetbrains.com/issue/WEB-25156 for updatesThank you for the fast answer. :)
So is it a react-native issue? Do you have any idea of when it will be supported?
No, it's not a problem with React native - it allows debugging Typescript, but you need to overwrite its default transformer with
react-native-sm-transformerto make it work. And Webstorm won't allow you to do this, as it doesn't support passing parameters to react-native 'start' command. So it's a webStorm issue, https://youtrack.jetbrains.com/issue/WEB-25156Ok, I just couldn't get it to work from the command terminal with react-native-sm-transformer and Chrome dev tools - the .ts files where simply empty. I guess I will have to look elsewhere for a solution to that problem.
Back to the original issue: Do you have any plans on supporting parameter passing to react-native start command in WebStorm/IDEA?
>just couldn't get it to work from the command terminal with react-native-sm-transformer and Chrome dev tools - the .ts files where simply empty
must be either a configuration issue or react-native problem...
>Do you have any plans on supporting parameter passing to react-native start command in WebStorm/IDEA
sure, please follow WEB-25156 for updates. see https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with youtrack