Skip to main content

VSCode Debug

  • VSCode Debug

Artigo

TSConfig

{
"compilerOptions": {
"lib": ["es2020"],
"target": "es2020",
"outDir": "build",
"module": "CommonJS",
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true
}
}

Launch Config VSCode

  • launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/dist/src/app.js",
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"env": { "NODE_ENV": "development" },
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
],
"preLaunchTask": "npm: build - app",
"postDebugTask": "clean app"
}
]
}

Tasks

  • tasks.json
{
"version": "2.0.0",
"tasks": [
{

"type": "npm",
"script": "build",
"label": "npm: build - app",
"dependsOrder": "sequence",
"dependsOn": ["tsc: watch - tsconfig.json"]
},
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"option": "watch",
"problemMatcher": [
"$tsc-watch"
],
"group": {
"kind": "build",
"isDefault": true
},
"label": "tsc: watch - tsconfig.json"
},
{
"type": "shell",
"label": "clean app",
"command": "rm -rf ./dist"
},
]
}