0

I'm generating .js.map files so that I can debug my TypeScript code in Chrome. js.map files point to the correct location of the typescript in the "sources" property. sourceRoot is "", and sources is the path to the typescript code from the location of the js file on disk (using outDir in jsconfig.json so that they're placed under the WebContent tree), but the typescript is outside of the web content tree. In the debugger in Chrome, it shows that map files were detected, I see a directory tree in the Sources list in the debugger, it points to the right location on disk, and it contains all of my ts files in the right locations (visually), but opening any one of them shows empty contents. Double-clicking in the .js file in the debugger to set a bp takes me to the empty .ts file. I don't know what details to provide in order to have a chance of getting help on this. All questions welcome.

rdiddly
  • 343
  • 1
  • 3
  • 13
  • The .js.map files are colocated with the .js files. The last line of the generated source says: `//# sourceMappingURL=sourceFile.js.map`. Since the js.map file is in the same directory as the .js file, I assume that this is correct. – rdiddly Feb 23 '18 at 17:05
  • Opening a .js file in the debugger source pane shows me this: `Source Map detected. Associated files should be added to the file tree. You can debug these resolved source files as regular JavaScript files. Associated files are available via file tree or Command-P.` Not sure if "should be added" means I need to do something, or that something was already done. – rdiddly Feb 23 '18 at 17:13
  • I'm using ts v2.6.2, Chrome v 62.0.3202.94, serving from Tomcat running via Eclipse. – rdiddly Feb 23 '18 at 17:50
  • I have gotten to a point where I can debug from within VS Code (I changed launch.json "webRoot" from ${workspaceFolder} to "${workspaceRoot}/.." just because I saw someone had done that elsewhere.) Now VS Code allows me to debug my app via Chrome Debugger, but Chrome itself, while allowing me to step through the code with bp's set, it can't show the source. – rdiddly Feb 23 '18 at 20:13

1 Answers1

0

I had the same problem as you. The solution is simple.

In your build.xml you have excluded somehow these *.ts files or their parent's folder, so the server doesn't load these files. You can find the excluded files and folders inside a tag fileset excludes="" in your build.xml.

Or inside the same fileset includes="" tag you don't include these files.

See my fileset:

see my fileset

xiawi
  • 1,772
  • 4
  • 19
  • 21
klitsios
  • 33
  • 5