简体   繁体   English

使用VS Code + Mocha和断点进行调试在“源映射中的只读内联内容”文件中停止

[英]Debugging with VS Code + Mocha and breakpoint stops at 'read-only inlined content from source map' file

I know, I know. 我知道我知道。

VS Code version: 1.25.1 Mocha: 4.0.1 VS代码版本:1.25.1摩卡:4.0.1

Running mocha via launch.json: 通过launch.json运行摩卡:

{
    "name": "mocha",
    "protocol": "inspector",
    "type": "node",
    "request": "launch",
    "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
    "stopOnEntry": false,
    "args": ["--no-timeouts", "--colors"], //you can specify paths to specific tests here
    "cwd": "${workspaceRoot}",
    "runtimeExecutable": null,
    "env": {
      "NODE_ENV": "testing"
    },
    "sourceMaps": true,
    "outFiles": [
        "${workspaceRoot}/dist"
    ],
  }

and set breakpoint in a file will open another tabbed window of same file with new title "read-only inlined content from source map" and breakpoint may be misaligned. 并在文件中设置断点将打开同一文件的另一个选项卡式窗口,并带有新标题“源映射中的只读内联内容”,并且断点可能未对齐。 In addition, you try to edit file and you realize you can't. 此外,您尝试编辑文件时,您发现自己做不到。

After flailing at different solutions, dang if setting the sourceMap to false worked for me: 经过不同的解决方案后,如果将sourceMap设置为false对我有用:

 "sourceMaps": false,

Note: the "outFiles" did nothing, it is an artifact of trying different solutions, including build a map to /dist. 注意:“ outFiles”什么也没做,它是尝试不同解决方案的产物,包括构建到/ dist的映射。

I'm not sure what changed in my configuration/setup. 我不确定配置/设置中发生了什么变化。 I just upgraded to vscode 1.25, but I don't really know. 我刚刚升级到vscode 1.25,但我真的不知道。

This answer is the opposite of Breakpoints and debugging statements open "read-only inlined content" 这个答案 Breakpoints 相反调试语句打开“只读内联内容”

Good luck! 祝好运!

Reposting answer from above: 从上面重新发布答案:

In launch.json:set sourceMaps to false: 在launch.json:中将sourceMaps设置为false:

"sourceMaps": false, “ sourceMaps”:否,

This answer is the opposite of Breakpoints and debugging statements open "read-only inlined content" 这个答案 Breakpoints 相反调试语句打开“只读内联内容”

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

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