vscode: [node-debugger] Debugger spams "Could not read sourcemaps" messages
- VSCode Version: 1.47.0-insider (system setup)
- OS Version: Windows_NT x64 10.0.19041
Steps to Reproduce:
- Add a dependency which has
.js-files containing//# sourceMappingURL=[...] - Make sure the dependencies do not contain source-maps
- Run the node-debugger
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

About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (13 by maintainers)
Commits related to this issue
- fix: exclude node_modules from sourcemap resolution by default Fixes https://github.com/microsoft/vscode/issues/102042 — committed to microsoft/vscode-js-debug by connor4312 4 years ago
- fix: exclude node_modules from sourcemap resolution by default Fixes https://github.com/microsoft/vscode/issues/102042 — committed to microsoft/vscode-js-debug by connor4312 4 years ago
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.
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 @connor4312in launch.json,
AND restart vscode, and it’s solved.
@manuth Thanks, buddy! Works like a charm.
thanks a lot, set
debug.javascript.usePreview: falseis worked for me.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.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
resolveSourceMapLocationsto remove that exclusion.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
typetopwa-nodeto go directly to the new debugger.@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 aProperty 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_modulesby default.It’s good here. I’ll direct people to it as needed 🙂