これは 2 回目の発生であり、ご想像のとおり、デバッガーが間違った情報を表示することは、デバッグ時に起こりうる最悪の事態です。ソース マップを使用すると、デバッガーは VM が特定の行にあると認識しますが、実際にはまだそこにないか、さらに悪いことに、この行に到達することはありません。ソース マップは、 UglifyJS2を使用する Grunt uglify プラグインで生成されます。
例:
if(something === 1){
console.log("it's something"); // debugger thinks the VM is here
else{
console.log("no it's not"); // while actually it's here
}
no it's not
デバッガーがif
私が経験した他の例は次のとおりです。
var that = this;
some.functionCall(1, function(){
console.log(that); //this is where the debugger thinks the vm is
// debugger: that = undefined
// console prints nothing to that point
});
プログラムを続行すると、console.log(that)
最終的には発火しました。
他の誰かが同じ問題を経験しましたか? UglifyJS2 または Google Chrome の問題である可能性が高いですか?
Chrome バージョン: 38.0.2125.8 dev (64 ビット)
Uglify2JS: 2.4.0
grunt-contrib-uglify: 0.5.1