Windows 10中的Typescript构建任务在Windows 10上,Windows子系统用于Linux



我的VSCODE设置(在我的情况下为工作区设置)已设置为使用bash作为默认终端:

{
   "terminal.integrated.shell.windows": "C:\WINDOWS\Sysnative\bash.exe"
}

我需要能够调试我的应用程序。

我的tasks.json看起来像:

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "typescript",
            "tsconfig": "./tsconfig.json",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

因此,当我尝试构建项目/运行构建任务(即Ctrl + B)时,我会收到以下错误:

>执行任务:tsc -p; c: path_to_my_project tsconfig.json&quort;<

错误TS5058:指定的路径不存在:'c: path_to_my_project tsconfig.json'。

用退出代码终止的终端过程:1

如果我在设置中禁用bash,则使用默认的Windows终端,则构建正常。

我记得它在几个之前的VSCODE更新中工作,但是它停止在最新的VSCODE版本中使用。不确定这是如何相关的。

我试图修复一段时间,但最终放弃了内置的打字稿任务,而只是使用了一个自定义任务:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Typescript watch",
            "type": "shell",
            "command": "tsc --watch",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "reveal": "always",
                "panel": "new"
            },
            "problemMatcher": [
                "$tsc"
            ]
        }
    ]
}

最新更新