VS Code sourceMapPathOverrides

I have an Aurelia TypeScript project where my compiled JavaScript files are in a subfolder .../wwwrootand the TypeScript source files are in .../src. I am trying to use the Chrome Debugger extension in VS code, but breakpoints do not fall, and when I turn diagnosticLoggingon launch.json, the source displayed is incorrect: it looks in .../wwwroot/src/file.tsinstead .../src/file.ts.

I tried to solve it with help sourceMapPathOverrides, but without success. It seems I can not match my sourceRoot.

I tried this:

"webRoot": "${workspaceRoot}/wwwroot",
"sourceMapPathOverrides": {
    "/src/*": "${workspaceRoot}/src/*"     
},

This is the console console output to search for a source login.js:

›SourceMaps.loadSourceMapContents: Reading local sourcemap file from ...\wwwroot\dist\login.js.map
›SourceMap: creating for ...\wwwroot\dist\login.js
›SourceMap: sourceRoot: /src
›SourceMap: sources: ["login.ts"]
›SourceMap: webRoot: .../wwwroot
›SourceMap: resolved sourceRoot /src -> ...\wwwroot\src
›SourceMaps.scriptParsed: ...\wwwroot\dist\login.js was just loaded and has mapped sources: ["...\\wwwroot\\src\\login.ts"]

Note. Three dots ...indicate my remote drive path to the root of the project.

How to use sourceMapPathOverridesto search login.tsin .../src/?


- webRoot workspaceRoot :

"webRoot": "${workspaceRoot}"

, , . :

Paths.scriptParsed: http://localhost:9000/dist/login.js webRoot: c:\Users\username\Source\Repos\myproject, ( ).

, -, wwwroot , webRoot workspaceRoot . @Steffen?

,

/                    (project/source/git root)
/src                 (contains typescript, html files, is sourceRoot in source mapping)
/src/login.ts
/wwwroot             (root folder served by dev web server, should be webRoot shouldn't it?)
/wwwroot/index.html  (file opened by http://localhost:9000/ which starts Aurelia bootstrapper)
/wwwroot/config.js   (SystemJS config, maps * to dist/* )
/wwwroot/dist        (folder containing compiled application files)
/wwwroot/dist/login.js
+4

Source: https://habr.com/ru/post/1650639/


All Articles