dape.el and attaching to Node process
By default, dape.el’s `dape-configs` variable includes the `js-debug-node` and `js-debug-chrome` configurations. See https://github.com/svaante/dape/blob/4694a7323b6bb6747f072c4c1253d18cf07a113f/dape.el#L196-L231
However, those are meant to start a file you’re currently in in debug mode.
If you prefer to start your Node process somewhere else using node --inspect [myfile.js]
, the above two configurations won’t work.
Thankfully, it’s easy to add such a configuration yourself - see (js-debug-attach ...
at the bottom.
You can run it using M-x dape
and typing in js-debug attach :port 9229
. You have to provide the port because it’s not specified in the below `dape-configs` var, and dape allows you to add props before running a pre-made configuration.
Make sure to set up the debugger adapter package: https://github.com/svaante/dape?tab=readme-ov-file#javascript---vscode-js-