使用egg腳手架搭建好最基本的項目后,當我們想調試代碼時,該怎么做呢?你還是選擇不斷得console.log?太low了,那么該怎么debug呢?
本文針對 Node.js 7.x 及之后的版本
1.在根目錄創建 .vscode目錄,下面創建 launch.json
本文針對 Node.js 7.x 及之后的版本
1.在根目錄創建 .vscode目錄,下面創建 launch.json
// .vscode/launch.json
{
"version": "0.2.0", "configurations": [ { "name": "Launch Egg", "type": "node", "request": "launch", "cwd": "${workspaceRoot}", "runtimeExecutable": "npm", "windows": { "runtimeExecutable": "npm.cmd" }, "runtimeArgs": [ "run", "debug" ], "console": "integratedTerminal", "protocol": "auto", "restart": true, "port": 9999 } ] }