【问题标题】:NodeJs: Chrome inspector can map source but unable to debug on original sourceNodeJs:Chrome 检查器可以映射源但无法在原始源上调试
【发布时间】:2021-03-16 08:48:02
【问题描述】:

我已将 chrome 检查器附加到 NodeJS 进程,并看到 Chrome 可以检测正在运行的构建源代码(/dist 文件夹),并将源代码(/src 文件夹)正确映射到构建源代码

但是,每当我在原始源代码 (/src) 中放置一个调试点时,调试点就会设置为构建 (/dist) 版本中的正确行,我只能使用构建版本进行调试,但是不是原始源代码

情况如图 我做错什么了吗? 这是the previous question的后续,涉及VS Code Debugger,在VS Code的情况下,他们甚至无法检测到原始源或sourcemap!

【问题讨论】:

    标签: node.js debugging google-chrome-devtools remote-debugging


    【解决方案1】:

    这似乎是来自 babel 的错误异步源映射。我们必须将 @babel/core 从版本 7.9.0 升级到 7.13 并将这两个部分也添加到 .babelrc 中

      "presets": [
        [
          "@babel/preset-env",
          {
            "targets": {
              "node": true
            }
          }
        ]
      ],
      "retainLines": true,
    

    【讨论】:

      猜你喜欢
      • 2017-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-27
      • 2014-11-01
      • 2012-04-15
      • 2021-07-04
      • 1970-01-01
      • 2016-03-15
      相关资源
      最近更新 更多