Tools
VsCode Debug
使用 ts-node 执行当前文件
官方:https://github.com/TypeStrong/ts-node#visual-studio-code
参考:https://gist.github.com/cecilemuller/2963155d0f249c1544289b78a1cdd695
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "ts-node",
"request": "launch",
"skipFiles": [
"<node_internals>/**",
"node_modules/**"
],
"cwd": "${workspaceRoot}",
"env": {
"DEBUG": "cheffe",
"TS_NODE_PROJECT": "${workspaceFolder}/tsconfig.build.json"
}, // 环境变量
"internalConsoleOptions": "neverOpen",
"runtimeArgs": ["-r", "ts-node/register"],
"args": ["${file}", "--transpile-only"],
"sourceMaps": true,
"console": "integratedTerminal"
// "stopOnEntry": false, // 启动后立即暂停
},
],
变量地址:https://code.visualstudio.com/docs/editor/variables-reference