TypeScript无法自动生成JS Maps

时间:2019-03-27 15:31:55

标签: typescript visual-studio-code

运行VS Code 1.28.2

当我从扩展程序的extension.ts文件生成生成文件时,.ts文件的源映射文件不会自动在项目结构的out文件夹中生成

项目中只有从另一台机器生成的地图。

.vscode / launch.json

{
    "version": "0.2.0",
    "configurations": [{
            "name": "Run Extension",
            "type": "extensionHost",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": [
                "--extensionDevelopmentPath=${workspaceFolder}"
            ],
            "outFiles": [
                "${workspaceFolder}/out/**/*.js"
            ],
            "preLaunchTask": "npm: watch"
        },
        {
            "name": "Extension Tests",
            "type": "extensionHost",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": [
                "--extensionDevelopmentPath=${workspaceFolder}",
                "--extensionTestsPath=${workspaceFolder}/out/test"
            ],
            "outFiles": [
                "${workspaceFolder}/out/test/**/*.js"
            ],
            "preLaunchTask": "npm: watch"
        }
    ]
}

.vscode / tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "npm",
            "script": "watch",
            "problemMatcher": "$tsc-watch",
            "isBackground": true,
            "presentation": {
                "reveal": "never"
            },
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

./ tsconfig.json

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es6",
        "outDir": "out",
        "lib": [
            "es6"
        ],
        "sourceMap": true,
        "rootDir": "src",
        "strict": true,
        "resolveJsonModule": true
    },
    "exclude": [
        "node_modules",
        ".vscode-test"
    ]
}

即使我将./out重命名为其他名称,也永远不会创建新的out文件夹。我不确定尝试调试时在这里缺少什么。朝着正确方向的任何观点表示赞赏

1 个答案:

答案 0 :(得分:0)

似乎tsc -w的根目录仅在终端中运行tsconfig.json即可满足我的需求。根据设置,它看起来会自动发生