Steps to Reproduce:
.js-files containing //# sourceMappingURL=[...]
Does this issue occur when all extensions are disabled? Yes
Expected behavior
Just like in the previous version of VSCode, missing source-map files should not be reported (should they...?).
Actual behavior
VSCode reports an error for every missing source-map files (even the ones inside the node_modules folder). This makes reviewing mocha debug sessions quite hard.
Screenshot

Thanks for the issue, this message was added in https://github.com/microsoft/vscode-js-debug/issues/483, and matches what happens in the web browser if Chrome fails to resolve sourcemaps. (However, in Chrome you can toggle these messages, where our debug console has no such control.)
You can configure whether we resolve sourcemaps by specifying the new resolveSourceMapLocations option, e.g. this will disable resolution in node_modules:
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
],
👍 this comment/issue if you'd like a setting to toggle off these messages.
@connor4312 thank you very much for the rapid answer! 😄
Should I copy this issue over to microsoft/vscode-js-debug?
It's good here. I'll direct people to it as needed 🙂
@connor4312 I, btw, just gave it a go before - your recommended configuration works like a charm!
Though, it looks like the json-schema isn't up to date yet, as I receive a Property resolveSourceMapLocations is not allowed. when adding this to my configuration.
Instead of having an option to disable source-map messages I'd prefer to have these messages disabled for node_modules by default.
Currently, the old debuggers are "forwarding" the request to the new debugger (https://github.com/microsoft/vscode-js-debug/issues/548). They don't know about the new options, but will pass them through. You can change the debug type to pwa-node to go directly to the new debugger.
We've had quite a few people opening issues about this.
The root problem is not the spam, but errors about files you don't care about. If a source map failed for a file you _did_ expect to debug, it would not be desirable to hide that information. I think it's reasonable to just disable sourcemaps within node_modules by default; if users need them, they can configure the resolveSourceMapLocations to remove that exclusion.
@connor4312 Is the "${workspaceFolder}/**", part necessary?
I've noticed, that this default value causes issues when running debug-tasks in multi-root workspaces with resolveSourceMapLocations left undefined.
Something there is. If the locations list is left at null, we'll resolve all sourcemaps without checking paths. With it specified, we require the sourcemap to match one of the patterns.
But one alternative closer to parity is to set it to **, omitting workspaceFolder, which will match all paths (unless they're later excluded). Updated the default in js-debug to that.
I also experienced this issue and can verify the fix. I would strongly consider making this setting the default
Thanks for the feedback. It will be the default on the upcoming nightly build. I will also aim to get this in the upcoming recovery release.
"resolveSourceMapLocations": [
"${workspaceFolder}/",
"!/node_modules/**"
],
Where should I put the configuration?
"resolveSourceMapLocations": [
"${workspaceFolder}/",
"!/node_modules/**"
],Where should I put the configuration?
Into your launch.json file as seen here:
https://github.com/manuth/NPMPackageEditor/blob/1564214c0d4a5dbf9b377218eb54edeaddf2fb3c/.vscode/launch.json#L15-L18
Keep in mind to change the type-property to pwa-node as mentioned by @connor4312
@manuth Thanks, buddy! Works like a charm.
in launch.json,
"type": "pwa-node",
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
]
AND restart vscode, and it's solved.
"resolveSourceMapLocations": [
"${workspaceFolder}/",
"!/node_modules/**"
],Where should I put the configuration?
Into your
launch.jsonfile as seen here:
https://github.com/manuth/NPMPackageEditor/blob/1564214c0d4a5dbf9b377218eb54edeaddf2fb3c/.vscode/launch.json#L15-L18Keep in mind to change the
type-property topwa-nodeas mentioned by @connor4312
{
"configurations": [
{
"type": "pwa-node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"skipFiles": [
"<node_internals>/**"
],
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
],
}
]
}
this is my launch.json, it doesn't work
@pyuyu can you capture a trace log using these instructions?
If you're able to, add
"trace": trueto yourlaunch.jsonand reproduce the issue. The location of the log file on your disk will be written to the Debug Console. Share that with us.⚠️ This log file will not contain source code, but will contain file paths. You can drop it into https://microsoft.github.io/vscode-pwa-analyzer/index.html to see what it contains. If you'd rather not share the log publicly, you can email it to [email protected]
Verification steps:
require("typescript"); debugger; to a Node.js fileCould not read sourcemaps messagesVerification steps:
- Install typescript
- Add
require("typescript"); debugger;to a Node.js file- Verify that when you run it, you aren't blasted with
Could not read sourcemapsmessages
there is no more Could not read sourcemaps, however the breakpoint didnt stop at the position where set,but stop at the file compiled by Babel
You may be hitting https://github.com/microsoft/vscode/issues/102152. If not, please capture a trace log using the instructions I sent you.
You may be hitting #102152. If not, please capture a trace log using the instructions I sent you.
thanks a lot, set debug.javascript.usePreview: false is worked for me.
Most helpful comment
Thanks for the issue, this message was added in https://github.com/microsoft/vscode-js-debug/issues/483, and matches what happens in the web browser if Chrome fails to resolve sourcemaps. (However, in Chrome you can toggle these messages, where our debug console has no such control.)
You can configure whether we resolve sourcemaps by specifying the new
resolveSourceMapLocationsoption, e.g. this will disable resolution in node_modules:👍 this comment/issue if you'd like a setting to toggle off these messages.