Visual Studio Code debugging chrome, Breakpoints wont hit

I have a Angular2/typescript app I am developing in VSCode. I use Gulp to build the typescript files and gulp-sourcemap to create map files. Attaching/launching chrome works well after some tinkering with the chrome debug extension for VSCode, but I cannot get the breakpoints to hit. I run the website with “dnx web”, but I don’t think that should matter.

My folder structure is like this:


My launch.json looks like this:

  "version": "0.2.0",
  "configurations": [
      "name": "Launch",
      "type": "chrome",
      "request": "launch",
      "url": "http://localhost:8001/portfolios",
      "runtimeArgs": [
          "--new-window", //Open in new window
      "webRoot": "${workspaceRoot}/wwwroot", 
      "sourceMaps": true

and my gulp build task looks like this:

gulp.task('ts', function (done) {
  var files = gulp.src(tsToMove)
    .pipe(ts(tsConfig), undefined, ts.reporter.fullReporter());
    return files.js.pipe(sourcemaps.write(".",{sourceRoot: '../scripts'}))

I have verified that maps files are generated and stored in the same folder as the js files. when building.

Thanks for any hints.

Leave a Reply

4 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
newest oldest most voted
Notify of

If you are using the debugger for chrome extension I would check that you are running chrome with remote debugging? I was able to get mine working after I started running chrome with remote debugging. from For now, Chrome needs to be started with remote debugging enabled, and only supports one concurrent connection. This means if you open up DevTools inside Chrome, the connection to VS Code will get terminated by Chrome. This is slightly annoying, and we hope this issue will be fixed sometime soon. To do this i have a batch file that opens chrome with this… Read more »


I totally agree with RVCA18. It’s about the webRoot Setting that was wrong.
I had VS-Code ${workspaceRoot} pointing to a subfolder (just because I opened the project like that and had no script in the top-level folder). Since the index.html that is launched is in the top level folder I had to set the following Option in launch.json

"webRoot": "${workspaceRoot}/.."


Setting the workspace location to the location of my typescript files, and not my build files, worked for me.

Unverified Breakpoint (my compiled file location)

"webRoot": "${workspaceRoot}/build/client"

Working Breakpoint (my ts file location)

"webRoot": "${workspaceRoot}/client"

I feel I should mention that I am using the Debugger for Chrome extension


So I’ve been messing with this for hours and finally got it working: RVCA18 was right on with his answer: You need to make sure that webRoot is set correctly, and correctly will depend on where you are running dnx from. If from your ‘project’ folder, then that’s your actual webRoot. You can also use your sourcemap file. If you open the file, it has a structure something like this: {"version":3,"sources":[],"names":[],"sourcesContent":[]} Find the sources prop which is an array of all of your source files. For example, if I search for one of my class names, I find the source… Read more »