Depending where the sourcemap file is, vscode fails to locate the source while chrome dev tools has no problem to find it.
If you want to reproduce you can try with the first file structure where both vscode and chrome devtools are working.
Then compare with the second file structure that works only in chrome devtools.
File structure working in both
file.js
const value = true
debugger
console.log(value)
file.es5.js
var value = true;
debugger;
console.log(value);
//# sourceMappingURL=file.es5.js.map
file.es5.js.map
{
"version": 3,
"sources": [
"./file.js"
],
"names": [
"value",
"console",
"log"
],
"mappings": "AAAA,IAAMA,QAAQ,IAAd;;AAEA;;AAEAC,QAAQC,GAAR,CAAYF,KAAZ",
"file": "file.js"
}
Vscode pauses in file.js

Chrome dev tools pauses in file.js

File structure failing in vscode
file.js
const value = true
debugger
console.log(value)
file.es5.js
var value = true;
debugger;
console.log(value);
//# sourceMappingURL=__asset__/file.es5.js.map
asset/file.es5.js.map
{
"version": 3,
"sources": [
"../file.js"
],
"names": [
"value",
"console",
"log"
],
"mappings": "AAAA,IAAMA,QAAQ,IAAd;;AAEA;;AAEAC,QAAQC,GAAR,CAAYF,KAAZ",
"file": "file.js"
}
vscode pauses inside file.es5.js

chrome devtools pauses in file.js

Additional info
When I put "trace": true inside launch.json one log draws my attention:
SourceMap: no sourceRoot specified, using script dirname
I think it corresponds to the following line in getComputedSourceRoot
|
logger.log(`SourceMap: no sourceRoot specified, using script dirname: ${absSourceRoot}`); |
It looks like vscode fallbaks on the script dirname but should fallback on the sourcemap dirname. Otherwise when sourcemap file and script file are not in the same directory sourceroot is wrong.
|
absSourceRoot = path.dirname(generatedPath); |
Depending where the sourcemap file is, vscode fails to locate the source while chrome dev tools has no problem to find it.
If you want to reproduce you can try with the first file structure where both vscode and chrome devtools are working.
Then compare with the second file structure that works only in chrome devtools.
File structure working in both
file.js
file.es5.js
file.es5.js.map
Vscode pauses in
file.jsChrome dev tools pauses in
file.jsFile structure failing in vscode
file.js
file.es5.js
asset/file.es5.js.map
vscode pauses inside
file.es5.jschrome devtools pauses in
file.jsAdditional info
When I put "
trace": trueinsidelaunch.jsonone log draws my attention:SourceMap: no sourceRoot specified, using script dirnameI think it corresponds to the following line in getComputedSourceRoot
vscode-chrome-debug-core/src/sourceMaps/sourceMapUtils.ts
Line 53 in 87d2c19
It looks like vscode fallbaks on the script dirname but should fallback on the sourcemap dirname. Otherwise when sourcemap file and script file are not in the same directory sourceroot is wrong.
vscode-chrome-debug-core/src/sourceMaps/sourceMapUtils.ts
Line 52 in 87d2c19