M
M
marsdenden2019-04-24 12:35:37
Google Chrome
marsdenden, 2019-04-24 12:35:37

Why does devtools show the wrong line number where console.log was called in a vue.js project?

Actually, the problem is that devtools somehow shifts the numbering when outputting to the console and stepping through the code. The project on vue.js, develop mode, source map are generated and everything seems to be fine there
5cc02bddea5a9888134850.png
console.log on line 328.
But in the console itself, devtools shows that the output was made from line 329.
5cc02c0e0646a894595694.png
If you insert a debugger into the code, then for debugging the cursor stops at the next line, and when stepping, it shifts by one line, that is, when passing the construction of the form

x=2;
  return x;
}

if the cursor is on return x, in fact, pressing F10 will execute the previous line, and the return from the function will be executed when F10 is pressed on the line with the closing bracket.
Whose problem is it - vue.js, webpack that generates the source map, or the devtools itself? Judging by the first screen, the maps are generated normally

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question