Chrome javascript debugger breakpoints don't do anything?

前端 未结 21 995
时光说笑
时光说笑 2020-12-02 18:14

I can\'t seem to figure out the Chrome debugging tool.

I have chrome version 21.0.1180.60 m.

Steps I took:

  1. I pressed ctrl-shift-i to bring up t
相关标签:
21条回答
  • 2020-12-02 18:48

    I had the same issue in a 10K line file. The breakpoints were being ignored,
    hard coded _debugger statements worked, but they can't be toggled and can be annoying when placed in a loop. My solution, which is a bit of a hack but it works is to add the following to the top of the file:

    let myDebuggerFlag = false;
    let myDebugger = function () {
        if (myDebuggerFlag) {
            debugger;
        }
    }
    

    then I add a myDebugger(); inline where I would usually use a breakpoint.

    to turn debugging on i simply enter myDebuggerFlag = true; on the console line. (you have to step out of myDebugger first of course.

    0 讨论(0)
  • 2020-12-02 18:50

    I had an issue where Chrome's breakpoints weren't firing anything. When I tried to use 'debugger' in my code, I could only step through the code in the VM version of my code. My issue was that I was mapping the resources incorrectly. Re-mapping fixed my problem.

    0 讨论(0)
  • 2020-12-02 18:50

    My solution was to clear the Local Storage, Session Storage, and Cookies from the Applications tab. After that, Chrome would pause script execution on the breakpoints defined in Sources.

    1. Click on the Applications tab of Google Chrome
    2. Right-click on the URL under each folder > Clear

    Screenshot: Applications tab

    0 讨论(0)
提交回复
热议问题