"module": "commonjs", "outDir": "out", "sourceMap": true, }, "include": [ "src/**/*" ] } 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. tasks.json { "version": "2.0.0", "tasks": [ { "type": "typescript", "tsconfig": "tsconfig.json", "problemMatcher": [ "$tsc" ...
"name":"Debug Typescript File","skipFiles":["<node_internals>/**"],"program":"${workspaceFolder}/index.ts","sourceMaps":true,"preLaunchTask":"npm: build",// "outFiles": [//"${workspaceFolder}/build/**/*.js"// ]"console":"externalTerminal"}]}...
这个对我们debug来说很重要,可以生成typescript的文件的source maps。 这时你已经可以编译ts文件了,在终端中输入tsc或者tsc index.ts。tsc会全部编译输出到你的目标文件夹中,而tsc index.ts只会编译index.ts文件。 tsc编译 接着打开你的vscode,按下F5,或者左侧面板中点击debug面板按钮 debug 创建一个launch.json文...
调试TypeScript 单元测试的关键是在 VSCode 中正确配置launch.json文件。 3.1 创建调试配置文件 打开VSCode,使用快捷键Ctrl + Shift + D切换到调试视图,点击 “create a launch.json file” 创建档案,选择 Node.js 环境,最后修改launch.json内容如下: {"version":"0.2.0","configurations":[{"type":"node","...
1. vscode 直接debug ts 文件 安装 TypeScript Debugger 插件 安装依赖 npm i ts-node typescript注意:原来通过...
首先我们需要将typescript编译成javascript。这里我们利用vscode的task功能,创建并运行一个监视typescript项目源代码变化后自动进行编译的task。 ctrl+alt+P打开任务窗口(mac下是command+shift+p): 在>提示符下输入: configure default build task,将出现下面的搜索文本框: ...
打开DEBUG 界面,添加 配置 或者编辑/.vscode/launch.json。 {"version":"0.2.0","configurations":[{"name":"Current TS File","type":"node","request":"launch","program":"${workspaceRoot}/node_modules/ts-node/dist/_bin.js","args":["${relativeFile}"],"cwd":"${workspaceRoot}","protocol...
为ts-node注册一个vsc的debug任务,修改项目的launch.json文件,添加一个新的启动方式 { "name": "Current TS File", "type": "node", "request": "launch", "args": [ "${workspaceRoot}/src/index.ts" // 入口文件 ], "runtimeArgs": [ ...
为ts-node注册一个vsc的debug任务,修改项目的launch.json文件,添加一个新的启动方式 代码语言:javascript 复制 {"name":"Current TS File","type":"node","request":"launch","args":["${workspaceRoot}/src/index.ts"// 入口文件],"runtimeArgs":["--nolazy","-r","ts-node/register"],"sourceMap...