launch.json
file should be saved on ${workspaceFolder}\.vscode\.launch.json
Last active
January 12, 2021 01:39
-
-
Save kamal-hossain/98f632de0bf13e85e72887c8c330e799 to your computer and use it in GitHub Desktop.
For
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
/* | |
// ############################## | |
// FOR nodejs app | |
// tested on: | |
//node v12.18.1, | |
// npm v6.14.5, | |
// vscode:: | |
// Version: 1.52.1 (user setup),Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523, | |
// Date: 2020-12-16T16:34:46.910Z, Electron: 9.3.5, Chrome: 83.0.4103.122, Node.js: 12.14.1 | |
// ,V8: 8.3.110.13-electron.0, OS: Windows_NT x64 10.0.19041 | |
############################## | |
*/ | |
// 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": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "YOUR APP NAME", | |
"skipFiles": [ | |
"<node_internals>/**" | |
], | |
"program": "${workspaceFolder}\\server.js", // entry point of the app | |
"restart": true, // for nodemon | |
"runtimeExecutable": "nodemon", // nodemon must be installed globally | |
"console": "integratedTerminal" // will use the vscode intregated terminal | |
} | |
] | |
} |
- Press
ctrl+shift+D and create a
launch.json` file - Configure the entry point of the server e.g.
"program": "${workspaceFolder}\\server.js",
- Add
nodemon
configuration if needed (view thelaunch-.-json
file attached in this gist for example)
- Go to top menu => Run > Start Debugging
- Select
Node.js (preview)
- Select
Run Script: start
- View the console for debugger attached
- Tested in the following versions:
or use
lunch.json
from here
- add a breakpoint in line
- hover over variables or type varible name in DEBUG CONSOLE
you can also run prototype functions like splice()
-
Add brekpoint in TypeScript file to inspect via vscode debugger and Debugger for Chrome
- Install
Debugger for Chrome
extension in vscode F9
to add breakpoint- Set
"sourceMap": true,
intsconfig.json
- Go to
Run
>Start Debugging
- Select environment
Chrome
(it won't appear with chrome extention) - In
launch.json
file seturl
to specefic port where developemnt server is running e.g. (http://localhost:3000) - Make sure
webRoot
is correct - Run
tsc
inbash
- Now
Start debugging
with thelaunch.json
is correctly configured - Now see the VARIABLES in left side of vscode
- Install
-
Resources https://code.visualstudio.com/docs/typescript/typescript-debugging
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment