我已经安装了最新版本的VS Code,并尝试编译一个“app.ts”文件,以便获得“app.js”和“app.js.map”。但是当我编译这个项目时,它只会创建“app.js”文件并且不会创建映射文件。VS Code TypeScript SourceMap创建
在我的根文件夹我有一个 “.vscode” 文件夹下面的 “tsconfig.json”
{
"compilerOptions": {
"target": "es6",
"module": "amd",
"sourceMap": true
}
和的 “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 HelloWorld program to compile.
"args": ["app.ts"],
// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
}
}
和在根目录下我有我的“app.ts”文件
module App {
export class Person {
constructor(public name: string) { }
public log(showLog: boolean): void {
if (showLog) {
console.log("Der Name des Nutzers ist: " + this.name)
}
}
}
}
var person = new App.Person("Hallo Welt");
person.log(true);
但是当我用CTRL + SHIFT +编译过b仅仅创建app.js FIL e并且没有映射。
更新: 我还试图修改 “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": [" --sourcemap app.ts"],
// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
}
与--sourcemap说法,但它不工作。但是当我使用命令promt与以下命令:
c:\Temp\vsCode\tsc --sourcemap app.ts
然后一切工作正常,并创建映射文件。
我同样的结果尝试了最新版本的条目没有创建映射文件 – squadwuschel