Cannot breakpoint source TS file while debugging from VSCode #7363
Replies: 9 comments 4 replies
-
Is there a reason you're using the Here's my {
"configurations": [
{
"command": "yarn dev",
"name": "Debug dev",
"request": "launch",
"type": "node-terminal"
}
]
} |
Beta Was this translation helpful? Give feedback.
-
Never seen "node-terminal" before, but that does help things a little, at least with the The problem appears to be in two main areas. Adding additional breakpoints after the server is running.Even in the Adding breakpoints to code outside of the "initialisation" pass of the applicationI have added a few extensions to the Express app (as mentioned above) and am seeing different behaviour. Breakpointing the If I then clear all breakpoints and add it again inside the handler while the server is running, the following happens
My totally naive thoughts is that this is something to do with the conflation of how source maps are generated mixing with the HMR features of NextJS? I can see some people with similar issues with NextJS apps with increasingly complex setups for their |
Beta Was this translation helpful? Give feedback.
-
I think that I've been able to set breakpoints in files other than |
Beta Was this translation helpful? Give feedback.
-
Ok I finally got a chance to test this with a minimal example https://github.com/xenobytezero/keystone-debugging-example This is a After launching the debugger with F5, I hit the breakpoint inside |
Beta Was this translation helpful? Give feedback.
-
Just looked at your sample app, that's using |
Beta Was this translation helpful? Give feedback.
-
Just realised that myself, updating my actual app as we speak, will report back with an updated app if its still an issue |
Beta Was this translation helpful? Give feedback.
-
Pushed change to the Github, updated to latest versions of everything, issue is persisting. |
Beta Was this translation helpful? Give feedback.
-
@xenobytezero Thanks. I can repo too. I'll have a dig around and reach out to the VS Code team as well |
Beta Was this translation helpful? Give feedback.
-
Apparently, the problem lies in ..\node_modules@keystone-6\core\dist\loadConfig-91b801c9.cjs.dev.js within the getEsbuildConfig function. After I added 'sourcemap: true', esbuild produced a source map, and VS Code attached the debugger without any issues.
I'm confident that there's a more optimal solution, but this is food for thought. |
Beta Was this translation helpful? Give feedback.
-
I am having an issue where I cannot set breakpoints in the original source of my code files when using
keystone dev
from VSCodeI have the following in my
launch.json
and setting a debug point in
keystone.ts
near the start will breakpoint, but will break on what appears to be the transpiled JavaScript in a new tab, even though the file name and path are the same as the original source.This is also true of extra code I have written that is used in the
keystone.ts
, namely extensions to the ExpressJS app viaserver.extendExpressApp
in the config.Does anyone have a working launch.json that lets them debug the original source?
Beta Was this translation helpful? Give feedback.
All reactions