Reputation: 472
From Visual Studio Code, I am able to debug and step through the TypeScript source of Main.ts, provided the JavaScript and map files coexist in the same folder as the TypeScript source.
This arrangement works -
debugDemo\
.vscode
launch.json
TypeScript\
Main.ts
Main.js
Main.js.map
However, I don't want the JavaScript files in the TypeScript folder, but instead would like the JavaScript in the JavaScript folder. I understand this can be achieved via a launch.json configuration using the outFiles attribute to identify where to locate the JavaScript.
For me, this arrangement does not work -
debugDemo\
.vscode
launch.json
TypeScript\
Main.ts
JavaScript\
Main.js
Main.js.map
The error is always - "Cannot launch program 'c:\debugDemo\TypeScript\Main.ts'; setting the 'outFiles' attribute might help"
What is wrong, how can I configure Visual Studio Code to look for the JavaScript files in the JavaScript folder? I experimented with various glob patterns for outFiles, but it did not help resolve the issue.
Main.ts Reduced to one line of code to reduce the problem complexity
console.log("debug");
Mapfiles built via
tsc --sourcemap TypeScript/Main.ts
which generates - TypeScript\Main.js , TypeScript\Main.js.map
launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Test",
"program": "${workspaceRoot}/TypeScript/Main.ts",
"cwd": "${workspaceRoot}",
"outFiles": ["${workspaceRoot}/JavaScript/**/*.js"],
"sourceMaps": true
}
]
}
Upvotes: 0
Views: 946
Reputation: 40712
Your command tsc --sourcemap TypeScript/Main.ts
does not output the files into JavaScript
folder. You have to specify the outDir
and specify the JavaScript
folder:
tsc --sourcemap --outDir "JavaScript" TypeScript/Main.ts
See TypeScript compiler options.
Upvotes: 1