【问题标题】:How to prevent to step into node_modules如何防止进入 node_modules
【发布时间】:2017-08-02 21:05:26
【问题描述】:

在 vs 代码编辑器中调试 typescript 项目文件时如何防止进入 node_modules/*.js 文件。当我在我的 typecipt 文件上使用 berakpoint 启动调试过程时,我想跳过 js node_modules 目录下的文件。

//我的launch.json

{
  "version": "0.2.0",
  "configurations": [ {
      "name": "LaunchChrome",
      "type": "chrome",
      "request": "launch",
      "url": "http://localhost:4200",
      "sourceMaps": true,
      "trace": true,
      "webRoot": "${workspaceRoot}",
      "userDataDir": "${workspaceRoot}/.vscode/chrome",
       "runtimeArgs": [ "--disable-web-security"]
    } ]
}

【问题讨论】:

  • 在那个地方放一个debugger,因为它是一个js文件。

标签: angular typescript visual-studio-code


【解决方案1】:

将以下内容添加到您的 launch.json...

"skipFiles": [
    "${workspaceRoot}/node_modules/**/*.js"
]

从您的问题的声音来看,您可能还想排除以下...

"skipFiles": [
    "${workspaceRoot}/node_modules/**/*.js",
    "<node_internals>/**/*.js"
]

如果您愿意,也可以排除 node internal files(net.js、events.js 等)。

通过文档here

【讨论】:

  • 感谢您的回答...“skipFiles”将是“配置”和“版本”的对等体
  • 来自文档,值得注意的是:If you step into a skipped file, you won't stop there - you will stop on the next executed line that is not in a skipped file.。这有点痛苦,我还没有找到解决办法。
猜你喜欢
  • 2019-01-18
  • 2019-11-16
  • 1970-01-01
  • 2019-09-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-12
相关资源
最近更新 更多