Search code examples
javascriptdebuggingsource-maps

Sourcemap request pending when breakpoint is hit. Is there a way to force a preload?


I am debugging a minified angular module.

I got an error:

Error inside the stack trace

I set my breakpoints on the sourcemap-deminified file (which are correctly generated) and I hit reload.

Surprisingly enough I end up hitting the breakpoint inside the non-human-readable minified file instead of the source-map translated ones. Why is that? Well the network tab showed a sad truth:

Network tab with pending .map file

This is happening while the whole computation is stuck because of the breakpoint in the minified file. So the request is locked in a pending status and Chrome has no idea how to map the minified file.

Have someone already experienced this problem? What was your solution?


Solution

  • I met with this issue. enter image description here Problem occur because Chrome does not caching the source map and trying to get it, but breakpoint prevent.
    The issue recurs if the page and dev tools is open and press F5/Ctrl+R.
    If focus in the address bar and press Enter, then work out.
    Upd: works through time :(
    Upd2: I use angularjs + angular-route. I think i found a workaround: open a page, for example http://localhost/myPage, chrome load all necessary files (with source map). Then change the address in the bar, adding the client path, such as #123 (http://localhost/myPage#123). Chrome will not reload the page, and routing at client will work. Breakpoint should be dependent on the client path url #123, logic must be different with or not this parameter. Some thing like this:

    if ($route.current.params.id){
      //real logic with breakpoint
      debugger;
    }else{
      //nothing
    }