之前在項(xiàng)目之中使用 ts
, 但是每次都需要gulp
編譯一次代虾。而且debugger
及其麻煩喇伯。
后來看到了 ts-node
. 于是決定試一試
首先安裝
sudo npm install ts-node --save-dev
然后修改了vscode 的啟動(dòng)文件。
{
"name": "Current TS File",
"type": "node",
"request": "launch",
"args": [
"${workspaceRoot}/src/index.ts" // 入口文件
],
"runtimeArgs": [
"--nolazy",
"-r",
"ts-node/register"
],
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
然后 f5 然后就可以了熊经。
之后就不用再老是編譯,給js
加斷點(diǎn),真的很麻煩..