Visual Studio Code 中的 SourceMaps JavaScript
在 tsconfig.json
集
"sourceMap": true,
使用 tsc
命令與 TypeScript 源中的 js 檔案一起生成對映。
該 launch.json 檔案:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}\\index.js",
"cwd": "${workspaceRoot}",
"outFiles": [],
"sourceMaps": true
}
]
}
這將使用生成的 index.js(如果你的主檔案是 index.ts)檔案和 Visual Studio Code 中的偵錯程式啟動節點,該偵錯程式在斷點處停止並解析 TypeScript 程式碼中的變數值。