我寫了一個AngularJS應用程序,但它證明了一點噩夢調試。我正在使用Grunt + uglify來連接和縮小我的應用程序代碼。它還會在縮小的JS文件旁邊創建源地圖。AngularJS - 堆棧跟蹤忽略源圖
當文件中存在JS錯誤,但在AngularJS應用程序之外時,源映射似乎正常工作。例如如果我在其中一個文件的頂部寫入console.log('a.b');
,則Chrome調試器中記錄的錯誤會顯示原始文件的行+文件信息,而不是縮小的文件。
當Angular自身運行的代碼出現問題時(例如在Controller代碼中),就會出現問題。我從Angular獲得了一個很好的堆棧跟蹤,但它僅僅詳細說明了縮小文件而非原始文件。
有什麼我可以做,讓Angular承認源地圖?
舉例如下錯誤:
TypeError: Cannot call method 'getElement' of undefined
at Object.addMapControls (http://my-site/wp-content/plugins/my-maps/assets/js/app.min.js:1:2848)
at Object.g [as init] (http://my-site/wp-content/plugins/my-maps/assets/js/app.min.js:1:344)
at new a (http://my-site/wp-content/plugins/my-maps/assets/js/app.min.js:1:591)
at d (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js:29:495)
at Object.instantiate (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js:30:123)
而現在的錯誤是固定的鉻42 :) Cf https://code.google.com/p/chromium/issues/detail?id=357958。 –