1

I use typescript for nodejs server and I also use webpack and then output server.js file located in build folder not beside server.ts. When I use server.js in launch.json, debugger works and ofcourse hits breakpoints in bundled server.js file. the configuration in launch.json like below:

"name": "Nodemon Launch Server",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/server/build",
"runtimeExecutable": "nodemon",
"program": "${workspaceFolder}/server/build/server.js",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"outFiles": [
    "${workspaceFolder}/server/build/*.js"
]

but I want to debug ts files and set breakpoint on typescript codes not js. but when I change launch.json program as below:

"program": "${workspaceFolder}/server/server.ts",

it gives this error when I run the debugger:

Cannot launch program '...' because corresponding JavaScript cannot be found.

How can I fix this to debug ts files not webpack bundled js file?

1 Answer 1

0

The first one you should check is that the source maps has been generated. After that maybe you have to setup outFiles (e..g.:"outFiles": ["${workspaceFolder}/path-to-my-compiled-files/**/*.js"]).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.