I've checked the following answers:
How to debug async/await in visual studio code?
However neither have solved my issue.
I want to be able to debug native Async/Await from VSCode using Node.js v7.4.0 without the horrible Typescript transpiled version. I'm able to get Typescript to output the correct code ie no __awaiter etc. However, once I attempt to debug the code, all the transpiled state machine code appears!? So I can debug the code, its just not the code I want to debug. Is there anyway to prevent the debugged code from having the transpiled state machine code?
Here are the config files I have:
tsconfig.json
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"noImplicitAny": false,
"sourceMap": true,
"outDir": "lib",
"noUnusedParameters": false,
"noUnusedLocals": false,
"skipLibCheck": true
//"importHelpers": true
},
"exclude": [
"node_modules"
]
}
launch.json
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/jest-cli/bin/jest.js",
"stopOnEntry": false,
"cwd": "${workspaceRoot}",
//"preLaunchTask": "tsc",
"runtimeExecutable": null,
"args": [
"--runInBand"
],
"runtimeArgs": [
"--harmony-async-await",
"--no-deprecation"
],
"env": {
"NODE_ENV": "development"
},
"console": "integratedTerminal",
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/{lib}/**/*.js"
],
"skipFiles": [
"node_modules/**/*.js",
"lib/**/*.js"
]
}
To further illustrate what I'm on about, here is a snippet of code in the outputted javascript:
let handler = subscription.messageSubscription.handler;
debugger;
await handler(message.message, context);
However when debugged it looks like this:
case 4:
handler = subscription.messageSubscription.handler;
debugger;
return [4 /*yield*/, handler(message.message, context)];
case 5: