javascript - How to get a readable stack trace for a webpack production environment for a minified bundle with dev-tool set to s

Is it possible to get a readable stack trace for a webpack production environment for a minified bundle

Is it possible to get a readable stack trace for a webpack production environment for a minified bundle with dev-tool set to source-map? I am running Typescript and react with a Webpack build. An example of an exception that is being thrown is shown in the listing below:

http://localhost:8080/vendors~course-list.3042c44300bc08021f63.bundle.js:2:6029
http://localhost:8080/vendors~course-list.3042c44300bc08021f63.bundle.js:2:5067

in w in b in withRouter(b) in e in e in Suspense in div in e in e in S

In the above stacktrace the following observations can be made with the devtool option set to source-map:

  • names remain minimised, e.g. w, b and e.
  • minimised error locations are reported, e.g. line number and column numbers.

Is it possible to get a readable stack trace for a webpack production environment for a minified bundle with dev-tool set to source-map? I am running Typescript and react with a Webpack build. An example of an exception that is being thrown is shown in the listing below:

http://localhost:8080/vendors~course-list.3042c44300bc08021f63.bundle.js:2:6029
http://localhost:8080/vendors~course-list.3042c44300bc08021f63.bundle.js:2:5067

in w in b in withRouter(b) in e in e in Suspense in div in e in e in S

In the above stacktrace the following observations can be made with the devtool option set to source-map:

  • names remain minimised, e.g. w, b and e.
  • minimised error locations are reported, e.g. line number and column numbers.
Share Improve this question asked Oct 18, 2019 at 9:33 anon_dcs3sppanon_dcs3spp 3,0527 gold badges38 silver badges77 bronze badges 1
  • Did you get it to work? – Mick Commented Oct 18, 2019 at 13:10
Add a ment  | 

1 Answer 1

Reset to default 6

I'm using this npm package and it works great :)

https://www.npmjs./package/sourcemapped-stacktrace

Example:

    import * as sourceStackTrace from 'sourcemapped-stacktrace';
    ...

    const minifiedStack = new Error().stack;
    sourceStackTrace.mapStackTrace(minifiedStack, (stackTrace: string[]) => {
        // Do your thing here
    });

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744332707a4568965.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信