mapping to source code
npm install sourcemappingJSON.stringfy(errorObj.stack)即需要被解析的堆栈字符串,以及存放sourcemap文件的相对路径。
javascript文件名.map,需要直接存放在指定路径下
powershell
npm install sourcemapping -g
`
`powershell
Usage: sourcemapping [options]
Options:
-v, --version output the version number
-s, --stack stack string which can obtain from JSON.stringfy(Error.stack)
-m, --map sourcemap dir path. Where to find sourcemap
-h, --help output usage information
sourcemapping -s "ReferenceError: exclued is not defined\n at getParameterByName (http://localhost:7777/aabbcc/logline.min.js:1:9827)\n at http://localhost:7777/aabbcc/index.js:15:11" -m "./test"
`
$3
`powershell
----Sourcemap Result----
Uncaught ReferenceError: exclued is not defined
at Logline (../src/logline.js:62:31)
at (index.js:15:11)
------------------------
`
$3
工具使用TypeScript编写,修改源码后调试测试可以使用如下命令:
`powershell
npm install
npm run test
``