Skip to content

Can not debug typescript until changing source code of vscode #55678

@baivoom

Description

@baivoom

Environment:

Version: 1.25.1
Commit: 1dfc5e5
Date: 2018-07-11T15:40:20.190Z
Electron: 1.7.12
Chrome: 58.0.3029.110
Node.js: 7.9.0
V8: 5.8.283.38
Architecture: x64

Configuration

tsconfig

    "sourceMap": true,
    "sourceRoot": "./src",                                  
    "inlineSourceMap": false,               
    "inlineSources": false,                

debug configuration

{
    "type": "node",
    "request": "launch",
    
    "name": "Test1",
    "cwd": "${workspaceRoot}",
    
    "program": "${workspaceFolder}/src/tests/jasmine.ts",
    "trace": true,
    "env": {
        "NODE_ENV": "development"
    },
    "sourceMaps": true,
    "outFiles": [
        "${workspaceRoot}/generated/**/*.js"
    ]
}

Issue

While start to debug, the vscode always says '... because corresponding JavaScript cannot be found'

Workaround

trace and found that the ' absSourceRoot' always output empty string
the trace logs

SourceMap: sourceRoot: /home/l/work/projects/light1/package/src/
SourceMap: sources: ["tests/test1.ts"]
SourceMap: resolved sourceRoot /home/l/work/projects/light1/package/src/ ->

edit: "./node_modules/vscode-chrome-debug-core/out/src/sourceMaps/sourceMapUtils.js"
from line 28, change from:

else if (sourceRoot.startsWith('/')) {
            // sourceRoot is like "/src", would be like http://localhost/src, resolve to a local path under webRoot
            // note that C:/src (or /src as an absolute local path) is not a valid sourceroot
            absSourceRoot = chromeUtils.applyPathMappingsToTargetUrlPath(sourceRoot, pathMapping);
        }

to:

else if (sourceRoot.startsWith('/')) {
            // sourceRoot is like "/src", would be like http://localhost/src, resolve to a local path under webRoot
            // note that C:/src (or /src as an absolute local path) is not a valid sourceroot
            absSourceRoot = chromeUtils.applyPathMappingsToTargetUrlPath(sourceRoot, pathMapping);
            if (!absSourceRoot) absSourceRoot = sourceRoot
        }

Sorry, do not have much time to dig the problem. This issue might be due to my incorrect configuration, but I can not find out the solution so far.

Metadata

Metadata

Assignees

Labels

debugDebug viewlet, configurations, breakpoints, adapter issuesinfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions