My package.json file is shown below:
`
{
"name": "crm-backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "concurrently \"yarn tsc --watch\" \"yarn tsc-alias --watch\" \"nodemon -q dist/index.js\""
},
"author": "",
"license": "ISC",
"dependencies": {
"dotenv": "^16.0.3",
"express": "^4.18.2",
"mongoose": "^6.7.5"
},
"devDependencies": {
"@types/express": "^4.17.14",
"@types/mongoose": "^5.11.97",
"@types/node": "^18.11.10",
"concurrently": "^7.6.0",
"nodemon": "^2.0.20",
"tsc-alias": "^1.8.1",
"typescript": "^4.9.3"
}
}
`
I have experimented with different options in the launch.json file:
`
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Attach",
"port": 1234,
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node"
},
{
"name": "Launch Chrome with Debugger",
"port": 7999,
"request": "launch",
"type": "chrome",
"webRoot": "${workspaceFolder}/static",
},
{
"name": "Nodemon: Attach Express.js + TypeScript 2",
"type": "node",
"request": "attach",
"port": 9229,
"restart": true,
"protocol": "inspector",
"cwd": "${workspaceFolder}/backend"
}
]
}
`
Only the "Nodemon: Attach Express.js + TypeScript" configuration was functioning correctly (to make it work I had to include "--inspect-brk=0.0.0.0:9229" in the package.json after nodemon), but it was only capturing breakpoints in the compiled "js" files and not the source "ts" files.