我试图使用stacktrace.js报告错误,但是堆栈跟踪中的路径引用“ng://FormModule/MyComponent.ngfactory.js”
TypeError: Cannot read property 'push' of undefined
at Object.eval [as handleEvent] (ng:///FormModule/MyComponent.ngfactory.js:668:41)
at handleEvent (http://localhost/dist/form/angular-vendor.bundle.js:12204:138)
at callWithDebugContext (http://localhost/dist/form/angular-vendor.bundle.js:13665:42)
at Object.debugHandleEvent [as handleEvent] (http://localhost/dist/form/angular-vendor.bundle.js:13253:12)
at dispatchEvent (http://localhost/dist/form/angular-vendor.bundle.js:8808:21)
at http://localhost/dist/form/angular-vendor.bundle.js:9419:20
at HTMLAnchorElement.<anonymous> (http://localhost/dist/form/angular-vendor.bundle.js:29309:53)
at ZoneDelegate.invokeTask (http://localhost/dist/form/polyfills.bundle.js:7779:31)
at Object.onInvokeTask (http://localhost/dist/form/angular-vendor.bundle.js:4090:33)
at ZoneDelegate.invokeTask (http://localhost/dist/form/polyfills.bundle.js:7778:36)
at Zone.runTask (http://localhost/dist/form/polyfills.bundle.js:7546:47)
at HTMLAnchorElement.ZoneTask.invoke (http://localhost/dist/form/polyfills.bundle.js:7841:38)Stacktrace.js无法定位包文件及其对应的源映射,因为无法加载此路径
XMLHttpRequest cannot load ng:///FormModule/MyComponent.ngfactory.js. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.是否有人使用WebPack、Stacktrace.js并使源映射工作,或者有人知道如何解决此问题?
发布于 2018-09-23 04:46:17
通过将{offline: true}作为StackTrace.fromError方法的第二个参数,修正了角6项目中的类似问题,如下所示:
StackTrace.fromError(error, {offline: true}).then(...就像建议的那样这里。
https://stackoverflow.com/questions/45022952
复制相似问题