Debugging frontend js with chrome dev tools

Unsolved NodeBB Plugins
  • #1

    What is the ideal way to approach debugging scripts that run on page load?

    Javascript loaded from widget areas always runs in an individual VM with no file name reference making breakpoints that are meant to stop scripts that run on page load meaningless, because on every refresh chrome seems to think it's a new resource and gets rid of all the breakpoints.

    For some reason I get the same behavior with nodebb.min.js. The breakpoints are all lost on refresh, although the resource name is the same every time (nodeb.min.js?a-long-id-like-param)

    The only way I can think of is to cause whatever is meant to run on a page load to run on some sort of a specific event that is triggered after I got a chance to set the breakpoints. Or simply flood the code with console.logs

  • Global Moderator Plugin & Theme Dev

    @Qwertyzw you could put a debugger; statement where you want it to break.

Suggested Topics

| | | |