简体   繁体   中英

Prevent vscode node debugger from showing node_modules code

I'm trying to debug a really complex Angular 9 app in VSCode using Node Debugger, browser-preview and Debugger for Chrome , and the debugger leading me to node_module internal code constantly is driving me crazy.

I've tried using both Browser Preview: Launch and ng serve with this VSCode skipFiles configuration but the first one keeps entering node_modules, and the later is only trying to start chrome after i cancel te debugging process. (wich seems like a totally unrelated problem to the current topic, but i would like any opinions on that part if you feel like it)

I've already sent an issue to the maker of the browser-preview extension, since VSCode is giving me a Property not allowed warning with skipFiles . If anyone finds a problem and/or has a suggestion for the following launch.json, will be appreciated.

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "browser-preview",
            "name": "Browser Preview: Attach",
            "request": "attach"
        },
        {
            "type": "browser-preview",
            "request": "launch",
            "preLaunchTask": "npm: start",
            "name": "Browser Preview: Launch",
            "url": "http://localhost:4200",
            "webRoot": "${workspaceFolder}",
            "skipFiles": [
                "${workspaceRoot}/node_modules/**/*.js",
                "<node_internals>/**/*.js"
            ]
        },
        {
            "name": "ng serve",
            "type": "chrome",
            "request": "launch",
            "preLaunchTask": "npm: start",
            "url": "http://localhost:4200/",
            "webRoot": "${workspaceFolder}",
            "skipFiles": [
                "${workspaceRoot}/node_modules/**/*.js",
                "<node_internals>/**/*.js"
            ],
            "sourceMapPathOverrides": {
                "webpack:/*": "${webRoot}/*",
                "/./*": "${webRoot}/*",
                "/src/*": "${webRoot}/*",
                "/*": "*",
                "/./~/*": "${webRoot}/node_modules/*"
            }
        }
    ]
}

在此处输入图片说明

EDIT: My objetive is to avoid breakpoint spamming , by using "Step Into (F11)" and "Step Over (F10)" to navigate the code line by line, and "Continue (F5)" to jump to the next breakpoint when needed.

The warning is a Typescript level bug, and it does not affects in any way the compilation. Everything works as intended after thoroughly testing it with the following dependency set:

"@types/node": "^13.7.7",
"@angular/cli": "^9.0.5",
"@angular/compiler": "^9.0.5",
"@angular/compiler-cli": "^9.0.5",
"ts-node": "^8.6.2",
"tslint": "^6.0.0",
"typescript": "^3.7.5",
...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM