VS Code TypeScript SourceMaps via TSC not working

Can someone point me in the right direction, why can't I hit any breakpoints in any of my TS files, please? The application is a Node.JS application and is broadcast using TSC. The following is an example record app.ts file:

./SRC/app.ts

import 'reflect-metadata'; import kernel from './ioc' import { IServer } from './utilities/abstract/IServer' let server = kernel.get<IServer>("IServer"); server.start(); 

./Src/app.js

 "use strict"; require('reflect-metadata'); var ioc_1 = require('./ioc'); var server = ioc_1.default.get("IServer"); server.start(); //# sourceMappingURL=app.js.map 

./SRC/app.js.map

 {"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts"],"names":[],"mappings":";AAAA,QAAO,kBAAkB,CAAC,CAAA;AAE1B,oBAAmB,OACnB,CAAC,CADyB;AAG1B,IAAI,MAAM,GAAG,aAAM,CAAC,GAAG,CAAU,SAAS,CAAC,CAAC;AAC5C,MAAM,CAAC,KAAK,EAAE,CAAC"} 

./tsonfig.json

 { "compilerOptions": { "target": "es5", "module": "commonjs", "experimentalDecorators": true, "emitDecoratorMetadata": true, "sourceMap": true }, "exclude": [ "node_modules", "typings/main", "typings/main.d.ts" ] } 

./. Vscode / launch.json

 { "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "node", "request": "launch", "program": "${workspaceRoot}/src/app.js", "stopOnEntry": true, "args": [], "cwd": "${workspaceRoot}", "runtimeExecutable": null, "runtimeArgs": [ "--nolazy" ], "env": { "NODE_ENV": "development" }, "externalConsole": false, "sourceMaps": true, "outDir": null } ] } 

When I run the launch configuration, it stops in the JS file, not the TS file. Also breakpoints in the TS file give me the following hint:

TS Breakpoint Error

I would really like my TS and JS to live in different directories and use Gulp to do the translation, but I want this simple setup to work first. Is this just a case of TS breakpoints in VS Code that are pretty wrong or am I doing something wrong?

+5
source share
1 answer

Add start.json to the root folder with the configuration below

 { "version": "0.1.0", "configurations": [ { "name": "Launch type", "type": "node", "program": "src/app.ts", "stopOnEntry": false, "sourceMaps": true, "outDir": "bin" } ] } 

Here is the reference link for https://code.visualstudio.com/Docs/editor/debugging#_launch-configurations

-1
source

All Articles