問題
使用 Typescript 配合 VS Code 的 debugger 開發很方便,配合上 ts-node 的 register 就可以在 typescript 順暢的使用中斷點功能了。
不過最近在開發的時候好幾的專案都有同樣的問題,就是每次執行的時候總會在第一行自動停止,必須手動按下繼續,像下圖這樣;
沒有下任何中斷點的情況下會自動暫停,而且是在專案變大之後才會發生,這是我的 launch config
{
"name": "Node Inspector",
"type": "node",
"request": "launch",
"args": ["${workspaceRoot}/src/index.ts"],
"runtimeArgs": ["-r", "ts-node/register"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart",
"env": {
"NODE_ENV": "development"
},
"outputCapture": "std",
"console": "integratedTerminal"
}