【发布时间】:2015-11-09 12:14:34
【问题描述】:
我安装了 VS Code 来尝试一下。我在 .ts 文件上按 Ctrl+Shift+B。第一次,它要求我设置一个构建任务,我做到了。现在,我再次构建,它什么也没做。我没有收到任何错误或警告,但也没有 .js 文件。我错过了什么?
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": "silent",
// args is the program to compile.
"args": ["app.ts"],
// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
}
tsconfig.json
{
"compilerOptions": {
"target" : "ESS",
"module": "amd",
"sourceMap": true
}
}
【问题讨论】:
-
您能否提供您的 tsconfig 和 tasks.json 文件的外观。您需要正确设置这两个文件才能使其正常工作。查看本文以了解正确的步骤和配置。 blogs.msdn.com/b/typescript/archive/2015/04/30/…
-
我看过那篇文章。我没有 tsconfig.json 文件。这是必需的吗?
-
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": "silent", // args is the program to compile. "args": ["app.ts"], // use the standard tsc problem matcher to find compile problems // in the output. "problemMatcher": "$tsc" } -
tsconfig.json
{ "compilerOptions": { "target" : "ESS", "module": "amd", "sourceMap": true } }
标签: typescript visual-studio-code