-
-
Notifications
You must be signed in to change notification settings - Fork 432
Debugging Sapper app server in dev mode in Chrome or VS Code not possible #435
Comments
Enable debugging in Chrome and VS Code - fixes #435
Released 0.20.4 with the fix — thanks |
@Rich-Harris
For the last one it appears as
If I add
|
I am experiencing the exact scenario outlined above and despite having |
@adfra I am having the same problem intermittently - sometimes it works and sometimes it doesn't with no change to my code or configuration. |
This config works for me without any problem. {
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug app",
"protocol": "inspector",
"program": "${workspaceFolder}/node_modules/sapper/dist/cli.js",
"args": ["dev"],
"console": "integratedTerminal",
"autoAttachChildProcesses": true
}
]
} |
Thanks @mdorda - unfortunately the issue remains for me, even with an exact copy of your config.
When starting the debugger with mdorda's exact debug config I see this in the console:
Contrary to the log message, the server is actually up and available on port 3000. The 'Socket:...' messages are just me clicking around in the app and things getting logged on the server side from socket.io. Breakpoints however are not triggering. Any help would still be appreciated. Wondering if I need to point VSCode explicitly to where my compiled code is located or similar to fix sourcemaps? Loving Sapper/Svelte, but not being able to use IDE for debugging is a killer... |
Grayed out breakpoints are usualy caused by missing source maps. Do you send |
Thx again @mdorda - yes, I am. The dev option going to the svelte plugin being set to TRUE (mode = 'development'). See snippet below.
|
Ok, I tracked this one down, now just need a little help to fix this properly.
When I replace config.client.output() with its hard-coded return value...
...and swap the sourcemap value from false to true, the debugger works. (I did this for client AND server in the rollup.config.js). Above is just a nasty hack - @Rich-Harris, I got lost in the library files on chunk3.js, could you advise how to properly get the sourcemap value to be set to true here? |
Just wanted to add that @adfra's trick worked for me. As they mentioned, I had to add this to both the output: { ...config.server.output(), sourcemap: true }, UPDATE: nevermind, still getting the "Server is not listening on port 3000" after some delay :( |
You got the sourcemap bit right. Now step 2. Make sure your webroot is set correctly.
I commented on a related issue here. |
While I was able to debug the browser/client side of sapper, I had no success so far with the server/nodejs side. |
Seems like none of the config above work for debugging on the browser in the latest vscode versions. |
One can debug the server portion of a Sapper app quite well using ndb (because it handles child processes intelligently out of the box), but currently it's not possible to do so with Chrome's DevTools or VS Code. If one tries to run:
from inside a Sapper app, one gets:
...because
sapper dev
spawns a new process for the server, and by default this new process inherits all arguments from the parent process, including the port on which the DevTools server should run, and this port is obviously already occupied.The fix is quite simple and I'm already working on a PR, just wanted to leave this here in the meantime.
The text was updated successfully, but these errors were encountered: