简体   繁体   English

防止 vscode 节点调试器显示 node_modules 代码

[英]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.我正在尝试使用 Node Debugger、browser-preview 和 Debugger for Chrome 在 VSCode 中调试一个非常复杂的Angular 9 应用程序,而引导我到 node_module 内部代码的调试器不断让我发疯。

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.我已经尝试使用Browser Preview: Launchng serve 与此 VSCode skipFiles 配置一起使用,但第一个不断进入 node_modules,而后者只是我取消调试过程后才尝试启动 chrome。 (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 .我已经向browser-preview扩展的制造商发送了一个问题,因为 VSCode 给了我一个Property not allowed使用skipFiles警告。 If anyone finds a problem and/or has a suggestion for the following launch.json, will be appreciated.如果有人发现问题和/或对以下 launch.json 有建议,我们将不胜感激。

{
    // 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.编辑:我的目标是避免断点垃圾邮件,通过使用“Step Into (F11)”和“Step Over (F10)”逐行导航代码,并在需要时使用“Continue (F5)”跳转到下一个断点.

The warning is a Typescript level bug, and it does not affects in any way the compilation.该警告是 Typescript 级别的错误,它不会以任何方式影响编译。 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",
...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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