sourcemap-stacktrack-parser
v0.0.3
Published
sourcemap-stacktrack-parser
Downloads
9
Readme
Sourcemap-Stacktrack-Parser
解析Stacktrack中的源码位置
根据sourcemap将解析stacktrack
Installing / Getting started
npm i sourcemap-stacktrack-parser
// ======== Input Data =======
const error = {
stack:
"ReferenceError: xxx is not defined\n" +
" at http://localhost:7001/public/bundle.e7877aa7bc4f04f5c33b.js:1:1392\n",
message: "Uncaught ReferenceError: xxx is not defined", // 非必须
filename: "http://localhost:7001/public/bundle.e7877aa7bc4f04f5c33b.js" // 非必须
};
// ====== Run ==========
const parser = new StackParser(resolve(__dirname, "./sourcemapFolder")); //sourcemap文件位置
const originStack = await parser.parseOriginStackTrack(
error.stack,
error.message
);
// ====== Result =========
[{
source: "webpack:///src/index.js",
line: 24,
column: 4,
name: "xxx"
}]