-
Notifications
You must be signed in to change notification settings - Fork 119
sourcemap failing inside vscode but working inside chrome devtools #544
Comments
I forgot to tell you how I execute the files: For chrome I open the following html file. <script src="./file.es5.js"></script> For vscode I uses the following launch.json {
"version": "0.2.0",
"configurations": [
{
"name": "Launch with node",
"type": "node",
"request": "launch",
"program": "${file}",
"sourceMaps": true,
"trace": true,
},
]
} |
…sourcemap files not siblings of files
@dmail is your |
I think it was a mistake when I wrote my comment, I forgot to put Have you tried to reproduce? I will try on my side when feeling more energy to do so. |
Any thought regarding this suggestion ? |
I thought I had the same issue in my project so I created a simple web app with Not sure why it doesn't work for the other app I have though. |
Turns out I had some wrong From my side, VSCode debugger has no problem when we put source map in a different folder from the JS file. |
I see thanks, I try to repro today and let you know if I can still reproduce |
How did you generate the source map files? In my case it's "sources": [
"../file.js"
], |
I have generated them programatically using babel. Webpack seems to use a special scheme (webpack://) that vscode seems to understand and resolve differently than relative path |
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.js
Chrome dev tools pauses in
file.js
File structure failing in vscode
file.js
file.es5.js
asset/file.es5.js.map
vscode pauses inside
file.es5.js
chrome devtools pauses in
file.js
Additional info
When I put "
trace": true
insidelaunch.json
one log draws my attention:SourceMap: no sourceRoot specified, using script dirname
I 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
The text was updated successfully, but these errors were encountered: