[英]Debug issue in vscode with typescript, nodemon, and external projects
Thank you for anyone who is able to offer some insight about what is going on.感谢任何能够对正在发生的事情提供一些见解的人。 VS Code debugging has always been finicky, but I've got a situation that I think should work and it isn't.
VS Code 调试一直很挑剔,但我遇到了一种我认为应该可行的情况,但事实并非如此。
Issue: I can set breakpoints in typescript and debug in 2 of my projects (server and common-internal), but not the 3rd (common-external).问题:我可以在 typescript 中设置断点并在我的 2 个项目(服务器和公共内部)中进行调试,但不能在第 3 个(公共外部)中进行调试。 Why can't I debug common-external, and how do I set it up so I can?
为什么我不能调试 common-external,我该如何设置才能调试? VS Code cannot find the source to bind the breakpoint.
VS Code 找不到绑定断点的源。
I've created a simple repo to reproduce the issue I'm seeing: https://github.com/snotmare/debug-issue我创建了一个简单的 repo 来重现我看到的问题: https://github.com/snotmare/debug-issue
Steps to reproduce:重现步骤:
Project setup:项目设置:
External project setup:外部项目设置:
The server project depends on the 2 common projects like this:服务器项目依赖于 2 个常见项目,如下所示:
"dependencies": {
"common-internal": "file:../common-internal",
"common-external": "file:../../common-external/common-external",
"express": "4.18.2"
},
I believe the issue is related to the folder structure, which looks like this:我认为问题与文件夹结构有关,如下所示:
root folder
- test-app
- - .vscode
- - common-internal
- - server
- common-external
- - .vscode
- - common-external
The folder structure needs to be this way because I want test-app to be in a git repo while common-external is in a separate git repo.文件夹结构需要这样,因为我希望 test-app 位于 git 存储库中,而 common-external 位于单独的 git 存储库中。
When I debug the server, why can't I set a breakpoint in common-external and debug it?调试服务器时为什么不能在common-external下断点调试? Thank you for your help!
谢谢您的帮助!
Github issue for vscode: https://github.com/microsoft/vscode/issues/169033 vscode 的 Github 问题: https://github.com/microsoft/vscode/issues/169033
Ben本
I found the solution for this by accident.我偶然找到了解决方案。 I was able to update the outFiles for my launch.json file to look for files outside of the workspace folder...
我能够为我的 launch.json 文件更新 outFiles 以查找工作区文件夹之外的文件...
"outFiles": [
"${workspaceFolder}/**/*.js",
"${workspaceFolder}/../common-external/**/*.js",
"!**/node_modules/**"
]
The vs code debugger is still finicky when it comes to my real (larger) project.当涉及到我的真实(更大)项目时,vs 代码调试器仍然很挑剔。 Sometimes it finds the source files, sometimes it doesn't.
有时它会找到源文件,有时却找不到。 Has anyone else experienced performance issues with the debugger?
其他人是否遇到过调试器的性能问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.