How can I debug my VS Code project in a multi-root workspace?
Unanswered
Least Storm-Petrel posted this in #help-forum
Least Storm-PetrelOP
Hi 👋
Say I have a monorepo (with turborepo and pnpm) in
I have opened the monorepo in VS Code using a multi-root workspace approach with the two roots (
Now, my breakpoints aren't binding (e.g. in
How can I make sure the breakpoints bind correctly?
Edit:
If I use the following config
I get an error in the debug console
Say I have a monorepo (with turborepo and pnpm) in
~/monorepo containing a Next.js app folder ~/monorepo/apps/my-app and a package folder ~/monorepo/packages/util.I have opened the monorepo in VS Code using a multi-root workspace approach with the two roots (
app/my-app/ and packages/).Now, my breakpoints aren't binding (e.g. in
page.tsx files) with the following launch.json config entry (taken from the docs):{
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev" //turbopack is enabled
}How can I make sure the breakpoints bind correctly?
Edit:
If I use the following config
{
"name": "Next.js: debug full stack",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/next",
"runtimeArgs": ["--inspect"],
"skipFiles": ["<node_internals>/**"],
"serverReadyAction": {
"action": "debugWithEdge",
"killOnServerStop": true,
"pattern": "- Local:.+(https?://.+)",
"uriFormat": "%s",
"webRoot": "${workspaceFolder}"
}
}I get an error in the debug console
Uncaught SyntaxError /home/michael/repos/monorepo/apps/my-app/node_modules/.bin/next:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at wrapSafe (internal/modules/cjs/loader:1469:18)
at <anonymous> (internal/modules/cjs/loader:1491:20)
at <anonymous> (internal/modules/cjs/loader:1689:10)
at <anonymous> (internal/modules/cjs/loader:1318:32)
at <anonymous> (internal/modules/cjs/loader:1128:12)
at traceSync (diagnostics_channel:315:14)
at wrapModuleLoad (internal/modules/cjs/loader:218:24)
at executeUserEntryPoint (internal/modules/run_main:170:5)
at <anonymous> (internal/main/run_main_module:36:49)
loader:1469
No debugger available, can not send 'variables'