1.Launch.json配置
1.1常规配置
// .vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Egg",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "npm",
"windows": { "runtimeExecutable": "npm.cmd" },
// 启动我们的 egg-bin debug 并默认是 brk
"runtimeArgs": [ "run", "debug", "--", "--inspect-brk" ],
// 日志输出到 Terminal,否则启动期的日志看不到
"console": "integratedTerminal",
"protocol": "auto",
// 进程重启后自动 attach
"restart": true,
// 因为无需再 proxy,故改回原来的 9229 端口
"port": 9229,
// 自动 attach 子进程
"autoAttachChildProcesses": true
}
]
}
2.其他
vscode 扩展生成的配置里面,还支持了单元测试的断点,配置如下:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Egg Test",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"test-local",
"--",
"--inspect-brk"
],
"protocol": "auto",
"port": 9229,
"autoAttachChildProcesses": true,
"disableOptimisticBPs": false,
}
]
}
源作者:星河子_YumWisdom
转载地址 https://blog.csdn.net/Aria_Miazzy/article/details/105558432