Hacker News new | ask | show | jobs
by chrisparton1991 2776 days ago
> Unlike JavaScript in the browser, or Java with a powerful IDE like IntelliJ, you can’t just set breakpoints everywhere

I'm using IntelliJ to set breakpoints everywhere in a Node application at this very moment. It's super easy to set up, you just create a Node.js run configuration and hit the debug button.

3 comments

Same here, but with Python. The IntelliJ debugger is one of the absolute best features and I haven't found anything comparable yet.
You can do this in VS Code as well. You create a launch.json file, and you can debug. A basic launch.json file is like 3 lines long, and VS Code makes it for you. There's no need for an extension. Maybe the author wasn't aware of that.
How does this work with transpilation? Say I have typescript or a just different js than the end build, how does the debugger know which line to put the breakpoint on?

Does the run config need to be something more structured than "run this gulp command"?

Pretty sure all you need is source maps.
Yep, source maps do the trick.
late response, but i just got stop debugging for a typescript/node app set up in webstorm. far easier than i (and this article) had built it up to be. the sourcemap stuff was actually already taken care of, it was the addition of `$NODE_DEBUG_OPTION` to the `ts-node-dev` command that did the trick