Debugging with chrome with es6

后端 未结 4 2047
情书的邮戳
情书的邮戳 2021-02-02 08:28

I am trying to use Ecmascript 2015 for my project and I am finding it hard to add breakpoints at specific places (places I thought was logical to have a breakpoint).

I

4条回答
  •  死守一世寂寞
    2021-02-02 08:51

    Normally I would solely blame sourcemaps, but from what you are showing here I am drawing a conclusion from comparing debug in chrome to the javascript debugger statement. I believe they do not work that differently.

    So we know that you cannot place a debugger statement within a functions parameters area.

    This is happening alot in your recorded example.

    .then(debugger)
    

    If you want to be able to break there you must add more code.

    .then((whatever) => { 
     // We need an existing empty line here.
     return whatever
    })
    

    Also turning off source maps is a good idea too, and then just step through the code line by line.

    I notice that you want to pause near or in promise flow. Remember this warning that pausing async code in complex apps can cause race conditions and furthermore lots of unexpected behavior.

提交回复
热议问题