Added Debug configuration for VSCode by oskardudycz · Pull Request #2 · oskardudycz/EventSourcing.NodeJS (original) (raw)

To configure VSCode debug you need to add launch.json file in the .vscode folder.

To not need to synchronise two separate configurations, we'll reuse the existing NPM script dev:start that starts the application.

{ "version": "0.2.0", "configurations": [ { "name": "Debug", "type": "node", "request": "launch", "runtimeExecutable": "npm", "runtimeArgs": ["run-script", "dev:start", "--", "--inspect-brk=9229"], "port": 9229 } ] }

As we have TypeScript configured, then we don't need any additional setup. We're reusing the native node debugging capabilities by using the --inspect-brk=9229 parameter. Read more in the Node.js documentation