如果这个问题之前被问过,我很抱歉重复发帖,请直接将我重定向到其他线程。
是否可以配置VS Code的"tasks.json"文件,以编译文件夹中的所有.ts文件。我知道我可以手动添加.ts文件的路径,就像这样:
"args": [ HelloWorld.ts ],
它确实能正确编译 HelloWorld.ts,但我无法弄清楚如何设置 tasks.json 以使文件夹中的所有 .ts 文件都被编译。
我查看了一些教程,它们都建议简单地删除 "HelloWorld.ts",但这并不起作用,因为根本没有编译任何 .ts 文件。
下面是我在 VS Code 中拥有的完整 tasks.json 文件:
{
"version": "0.1.0",
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
"command": "tsc",
// The command is a shell script
"isShellCommand": true,
// Show the output window only if unrecognized errors occur.
"showOutput": "always",
// args is the HelloWorld program to compile.
"args": [ "HelloWorld.ts" ],
// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
}