babel: Debugging babel in node (w/ babel/register) is faulty

Hey! When I try to debug a line on a project that uses 6to5/register to import ES6 modules, the code runs correctly, but debugging it with breakpoints becomes impossible:

  • Breakpoint breaks on the correct line, but it’s not the same line from source code that’s executing.
  • Stepping over/in/out jumps to wrong lines (or doesn’t jump at all)
  • Stack trace shows something else entirely

I’ve made a simple showcase for this, available here

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 20 (7 by maintainers)

Commits related to this issue

Most upvoted comments

I am experiencing an issue with the babel/register hook and node-inspector. I am able to set break points on what I believe to be a source map (I have a second “src” directory. One has transpiled code, one has non-transpiled code), but often times I cannot place it on the line that I would like.

I have also noticed that the execution jumps around across various different, incorrect lines in node-inspector. As far as I can tell - it isn’t a line number issue so much as my breakpoint ending up on the wrong line, etc. For example, it will say I am on line 30 in node-inspector when I’m really on 25, etc.

In the list of variable and values on the right, I don’t see references to what’s in scope based on the highlighted line, which is another factor in believing my debugger is executing the wrong line.

Does anyone have a fix?