0

I am unable to have my breakpoints hit in my typescript files inside my react-native project. I have looked at various similar questions here at stackoverflow and also on github. (here, here) Here is my tsconfig.json:

{
    "compilerOptions": {
        "target": "es2015",
        "module": "es2015",
        "jsx": "react",
        "outDir": "build",
        "rootDir": "src",
        "allowSyntheticDefaultImports": true,
        "noImplicitAny": true,
        "experimentalDecorators": true,
        "preserveConstEnums": true,
        "allowJs": true,
        "sourceMap": true
    },
    "filesGlob": [
        "typings/index.d.ts",
        "src/**/*.ts",
        "src/**/*.tsx"
    ],
    "exclude": [
        "index.android.js",
        "index.ios.js",
        "build",
        "node_modules"
    ],
    "compileOnSave": false
}

First I build my sources using visual studio code build task (ctrl+shift+B); every thing builds fine and .js files along with corresponding .js.map files are generated inside the ./build folders.

Then I create a launch configuration in the launch.json

From within visual studio code I start the debug process (f5). Every thing works fine and app is loaded and displayed inside my genymotion emulator.

But breakpoints inside typescript are never hit. (They are hit inside the generated .js files though)

I am completely at lost here. No matter what I do I can't get the breakpoints to get hit...

Any help would be greatly appreciated.

Arnold Schrijver
  • 3,588
  • 3
  • 36
  • 65
TheSoul
  • 4,906
  • 13
  • 44
  • 74
  • I've definitely hit issues here recently although with a different stack. Try `"inlineSourceMap"` instead of `"sourceMap"` and see if that helps. – Aluan Haddad Apr 17 '17 at 00:17
  • thanks for the reply. I tried "inlineSourceMap". Unfortunately breakpoints are still not hit – TheSoul Apr 17 '17 at 07:42
  • Have you looked at the source maps the compiler creates? – Aluan Haddad Apr 17 '17 at 07:43
  • It is inserted in the generated .js file. It looks like what one would expect sourcemaps to look like. Is there something in particular I should look for in the sourcemaps which might give me an hint? – TheSoul Apr 17 '17 at 07:45
  • I meant the non-inline ones, they would point to the expected location of their respective source files. Not sure about that emulator or how it behaves. In your VS Code launch.json configuration for F5, do you have `"sourceMaps": true` specified under your configuration? – Aluan Haddad Apr 17 '17 at 07:49
  • Yes the non-inline correctly point to the expected location of ther respective source file ( property "sources" point to the source folder) – TheSoul Apr 17 '17 at 07:59
  • And also the genymotion emulator is fine. I have been able to use it a couple of months ago on another react-native project. And every thing was wroking then, even my breakpoints – TheSoul Apr 17 '17 at 08:00
  • something must have changed... – Aluan Haddad Apr 17 '17 at 08:01
  • 1
    That is why I have downgraded my react-native cli and my vscode react-native tools to the version it was working...but no result... – TheSoul Apr 17 '17 at 08:02
  • I assume you have decimated all artifacts from old builds? – Aluan Haddad Apr 17 '17 at 08:03
  • 1
    I have created a fresh project from the downgraded version. That is waht I am trying now – TheSoul Apr 17 '17 at 08:04
  • react-native -v gives me: react-native-cli: 1.0.0 and react-native:0.41.2. My react native tools is 0.3.2 – TheSoul Apr 17 '17 at 08:08

1 Answers1

0

I have applied the suggestion from this github post especially to comment about this PR and now my breakpoints work.

TheSoul
  • 4,906
  • 13
  • 44
  • 74