Tools

VsCode Debug

使用 ts-node 执行当前文件
官方:https://github.com/TypeStrong/ts-node#visual-studio-code
参考:https://gist.github.com/cecilemuller/2963155d0f249c1544289b78a1cdd695

  1. {
  2. // Use IntelliSense to learn about possible attributes.
  3. // Hover to view descriptions of existing attributes.
  4. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  5. "version": "0.2.0",
  6. "configurations": [
  7. {
  8. "type": "node",
  9. "name": "ts-node",
  10. "request": "launch",
  11. "skipFiles": [
  12. "<node_internals>/**",
  13. "node_modules/**"
  14. ],
  15. "cwd": "${workspaceRoot}",
  16. "env": {
  17. "DEBUG": "cheffe",
  18. "TS_NODE_PROJECT": "${workspaceFolder}/tsconfig.build.json"
  19. }, // 环境变量
  20. "internalConsoleOptions": "neverOpen",
  21. "runtimeArgs": ["-r", "ts-node/register"],
  22. "args": ["${file}", "--transpile-only"],
  23. "sourceMaps": true,
  24. "console": "integratedTerminal"
  25. // "stopOnEntry": false, // 启动后立即暂停
  26. },
  27. ],

变量地址:https://code.visualstudio.com/docs/editor/variables-reference