Run & Debug: Launch.json
VS Code Run and Debugger with launch.json
NestJS
Prepare Environment
As NestJS environment, prebuild & postbuild commands are environment specific it is a good idea to run the relevant npm start command for that environment before using the VS Code debugger:
$ npm run start:dev
...
[ Press CTRL-C to exit node process so VS Code debugger may be started ]Start the Debugger
VS Code --> Run and Debug --> Launch NestJSyr nnnnpm run setenv:dev:julian && npm run prebuildnpm run setenv:dev:julian && npm run prebuildnnnpm run setenv:dev:julian && npm run prebuild
"version": "0.2.0",
"configurations": [
{
"name": "Launch NestJS",
"type": "node",
"request": "launch",
"preLaunchTask": "npm: build",
"args": [
"${workspaceFolder}/dist/main.js"
],
"runtimeArgs": [
"--nolazy",
"-r",
"ts-node/register",
"-r",
"tsconfig-paths/register"
],
"sourceMaps": true,
"envFile": "${workspaceFolder}/.env",
"cwd": "${workspaceRoot}",
"console": "integratedTerminal",
"protocol": "inspector"
},
{
"name": "Attach NestJS by PID",
"type": "node",
"request": "attach",
"processId": "${command:PickProcess}" ],
"compounds": []
}Angular
In the Angular launch.json we do not include environment, build & serve commands as they are envirnoment specific. Before executing:
Prepare Environment, Build & Serve:
Start the Debugger
VS Code --> Run and Debug --> Launch Chrome Attach Angular
Last updated
Was this helpful?
