我正在尝试使用VS Code Chrome调试器来调试Angular2(2.0.0-beta.9)和Typescript(v1.8.7).我在ts文件中设置断点但调试器正在显示js.当整个应用程序位于一个文件夹中时,调试器会显示ts,但当应用程序由子文件夹组成时,调试器的行为不正确.起初我以为它无法解析映射,但我已打开诊断程序,可以看到路径正在正确解析.
以下是诊断窗口中的示例:
›Paths.scriptParsed: resolved http://localhost:3000/bin/hero/hero.service.js to c:\MyDev\ng2\bin\hero\hero.service.js. webRoot: c:\MyDev\ng2
›SourceMaps.createSourceMap: Reading local sourcemap file from c:\MyDev\ng2\bin\hero\hero.service.js.map
›SourceMap: creating SM for c:\MyDev\ng2\bin\app.component.js
›SourceMap: no sourceRoot specified, using script dirname: c:\MyDev\ng2\bin
›SourceMaps.scriptParsed: c:\MyDev\ng2\bin\app.component.js was just loaded and has mapped sources: ["c:\\MyDev\\ng2\\app\\app.component.ts"]
›SourceMaps.scriptParsed: Resolving pending breakpoints for c:\MyDev\ng2\app\app.component.ts
Run Code Online (Sandbox Code Playgroud)
tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"outDir": "bin"
},
"exclude": [
"node_modules",
"typings"
]
}
Run Code Online (Sandbox Code Playgroud)
来自launch.json的部分:
{
"name": "Launch …Run Code Online (Sandbox Code Playgroud)