M-Zuber / npm-watch

run npm scripts when files change
MIT License
324 stars 38 forks source link

Can't attach debugger #64

Open michailw opened 5 years ago

michailw commented 5 years ago

Hi, I find impossible to configure node.js debugger with npm-watch. Could you please add that feature?

M-Zuber commented 5 years ago

Could you describe what you need in a bit more detail? you want npm-watch itself to be listening for a debugger, or to enable it run commands that listen?

michailw commented 5 years ago

I would like to enable it run commands that listen

M-Zuber commented 5 years ago

🤔 Do you happen to have a minimal script case that you would expect to work but doesn't?

justinwilaby commented 3 years ago

@michailw -

try this in a terminal with the cwd set to your project root:

node --inspect-brk=9222 ./node_modules/.bin/npm-watch

Then open chrome://inspect and attach to the debugger.

That should do it unless npm-watch spawns a new process for executing watch scripts.

M-Zuber commented 3 years ago

npm-watch does spawn new processes, but if I understood correctly, @michailw - your question is how to have npm-watch run a command where the command is listening for a debugger?

I have not managed to produce a test case, so I would appreciate it if you could send me a minimal case that you would expect to work, but it doesn't