Search code examples
javascriptdebuggingnode.jsnode-inspector

How do I set a break point inside of a "require"-d library with node inspector?


I have a library several layers of "require" down from my project, and I'd like to set a breakpoint inside it.

I'm new to node-inspector, and I'm trying to figure out how to find my way into the library and place the breakpoints there. The library isn't listed on the list of scripts, I'm guessing since a require does a dynamic load.

What's the standard way for placing the breakpoint under these conditions? Is the only option placing a breakpoint high in the call chain, and then finding my way down for a second one?


Solution

  • You can use the "debugger" keyword where you want that the debugger stops. It basically sets a breakpoint at that location.

    So you could put it in the library you want at the line you want to stop the execution.

    I got this from here.