鍍金池/ 問答/網(wǎng)絡(luò)安全  HTML/ 如何利用sourcemap去定位壓縮后的代碼位置

如何利用sourcemap去定位壓縮后的代碼位置

同事之前做的一些項目代碼用gulp壓縮后,用sourcemap生成的有.map文件。
后來同事離職了,然后現(xiàn)在我的工作郵箱收到了服務(wù)器發(fā)的這么一段錯誤日志:

js 錯誤Array
(

[msg] => Uncaught TypeError: Cannot read property 'status' of undefined
[file] => https://image.qnitem.dzsofts.net/js/copy_goods.min.js?qntag=153087588220171124
[url] => https://qnitem.dzsofts.net/html/copy_goods/index.html?tap1=1
[line] => 1
[col] => 58335
[error] => TypeError: Cannot read property 'status' of undefined
[trace] => TypeError: Cannot read property 'status' of undefined
at https://image.qnitem.dzsofts.net/js/copy_goods.min.js?qntag=153087588220171124:1:58335
at Object.error (https://image.qnitem.dzsofts.net/js/common.min.js?qntag=151756578120171124:1:3404)
at j (https://image.qnitem.dzsofts.net/js/jquery-1.11.1.min.js?qntag=145821312120171124:2:27244)
at Object.fireWith [as rejectWith] (https://image.qnitem.dzsofts.net/js/jquery-1.11.1.min.js?qntag=145821312120171124:2:28057)
at x (https://image.qnitem.dzsofts.net/js/jquery-1.11.1.min.js?qntag=145821312120171124:4:21868)
at XMLHttpRequest.b (https://image.qnitem.dzsofts.net/js/jquery-1.11.1.min.js?qntag=145821312120171124:4:25897)

)

之前看同事有利用Node命令弄了個什么配置文件后根據(jù)這個col找到了源代碼里的準(zhǔn)確位置,然而我這個萌新并沒用過這個……有沒有大佬指點一下這個是應(yīng)該怎么弄的??

回答
編輯回答
司令

去Npm上仔細(xì)看了下文檔,找到了,用的sourcemap的SourceMapConsumer.with這個API…………

2017年10月3日 03:13