[英]How to Run the TypeScript build in Visual Studio code?
我正在按照此文档在 Visual Studio 代码编辑器中运行 hello-world typescript 程序。
我已完成以下步骤
当我尝试运行类型脚本构建时,通过执行运行构建任务(⇧⌘B)我看不到任何要构建的任务。
所以我被困在这一点上。 有人能告诉我我们是否需要手动创建此任务吗? 或者是否有我缺少的先决条件?
谢谢!
尝试重新启动 VSCode。 如果这不起作用,请尝试通过以下方式配置任务:
Command palette (Ctrl+Shift+P / F1) > Tasks: Configure default build task
如果这在此处不起作用,则为默认任务配置:
{
"version": "2.0.0",
"tasks": [
{ // For build
"type": "typescript",
"tsconfig": "tsconfig.json",
"problemMatcher": [
"$tsc"
],
"group": "build",
"label": "tsc: build - tsconfig.json"
},
{ // For watch
"type": "typescript",
"tsconfig": "tsconfig.json",
"option": "watch",
"problemMatcher": [
"$tsc-watch"
],
"group": "build",
"label": "tsc: watch - tsconfig.json"
},
{ // If both of the above don't work you could create an npm script and run it via this task
"type": "npm",
"script": "build", // This should be the name of your script
"problemMatcher": [],
"label": "npm: build typescript"
}
]
}
为了检测到这些,在工作空间的根目录创建一个.vscode
文件夹,并在其中创建一个文件tasks.json
。 如果你把上面的 json 放进去,VSCode 会找到你的任务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.