From 312f1324ca1a7f58270b268db68b03ef797ef1d4 Mon Sep 17 00:00:00 2001 From: Jennifer Nguyen Date: Thu, 2 Jul 2020 00:42:31 -0700 Subject: [PATCH] Setting up Node.js debugger with Nodemon and Typescript in VSCode editor Refer to [article](https://dev.to/oieduardorabelo/nodejs-with-typescript-debug-inside-vscode-and-nodemon-23o7) for more information --- .vscode/launch.json | 13 +++++++++++++ nodemon.json | 6 +++++- package.json | 3 ++- 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..747f90b --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "attach", + "name": "Node: Nodemon", + "processId": "${command:PickProcess}", + "restart": true, + "protocol": "inspector" + } + ] + } \ No newline at end of file diff --git a/nodemon.json b/nodemon.json index 00b54fa..0ca8c43 100644 --- a/nodemon.json +++ b/nodemon.json @@ -2,5 +2,9 @@ "watch": ["src"], "ext": "ts", "ignore": ["src/**/*.spec.ts"], - "exec": "ts-node ./src/app.ts" + "execMap": { + "ts": "node --require ts-node/register" + }, + "verbose": true, + "restartable": "rs" } diff --git a/package.json b/package.json index a3aed5e..f3616e9 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "typescript": "^3.9.5" }, "scripts": { - "start": "nodemon" + "start": "nodemon src/app.ts", + "debug": "nodemon --inspect src/app.ts" } }