Angular 6 路由器在启用 polyfill 后在所有浏览器中崩溃应用程序?

Angular 6 router crashes app in all browsers after enabling polyfills?

我有一个 angular 6 PWA,一切都很好并且一直在运行,直到我启用了 polyfills。现在,当我 运行 ngserve 并尝试导航到另一个组件时,它只是出错并且路由器出口变为空白。

我有一个类似的应用程序,运行良好,看看我是否用这些 polyfills 破坏了某些东西 - 我只是将 polyfills 文件复制粘贴到那里,结果相同。

我也尝试过 运行 ng serve --prod 但结果完全相同。

我还注释掉了除 reflect 和 zone 之外的 polyfill,因为它们是默认启用的,现在行为仍然存在。不知道还有什么可以尝试这个。

ERROR Error: "[object Object]"
resolvePromisehttp://localhost:4200/polyfills.js:7406:31resolvePromisehttp://localhost:4200/polyfills.js:7363:17scheduleResolveOrRejecthttp://localhost:4200/polyfills.js:7465:17invokeTaskhttp://localhost:4200/polyfills.js:7013:17onInvokeTaskhttp://localhost:4200/vendor.js:62603:24invokeTaskhttp://localhost:4200/polyfills.js:7012:17runTaskhttp://localhost:4200/polyfills.js:6780:28drainMicroTaskQueuehttp://localhost:4200/polyfills.js:7187:25invokeTaskhttp://localhost:4200/polyfills.js:7092:21invokeTaskhttp://localhost:4200/polyfills.js:8132:9globalZoneAwareCallbackhttp://localhost:4200/polyfills.js:8158:17 core.js:1673
    defaultErrorLogger
    core.js:1673
    ./node_modules/@angular/core/fesm5/core.js/ErrorHandler.prototype.handleError
    core.js:1719
    next
    core.js:4311:109
    ./node_modules/@angular/core/fesm5/core.js/EventEmitter.prototype.subscribe/schedulerFn<
    core.js:3551:34
    ./node_modules/rxjs/_esm5/internal/Subscriber.js/SafeSubscriber.prototype.__tryOrUnsub
    Subscriber.js:195
    ./node_modules/rxjs/_esm5/internal/Subscriber.js/SafeSubscriber.prototype.next
    Subscriber.js:133
    ./node_modules/rxjs/_esm5/internal/Subscriber.js/Subscriber.prototype._next
    Subscriber.js:77
    ./node_modules/rxjs/_esm5/internal/Subscriber.js/Subscriber.prototype.next
    Subscriber.js:54
    ./node_modules/rxjs/_esm5/internal/Subject.js/Subject.prototype.next
    Subject.js:47
    ./node_modules/@angular/core/fesm5/core.js/EventEmitter.prototype.emit
    core.js:3535:52
    onHandleError/<
    core.js:3842:48
    ./node_modules/zone.js/dist/zone.js/</ZoneDelegate.prototype.invoke
    http://localhost:4200/polyfills.js:6980:17
    ./node_modules/zone.js/dist/zone.js/</Zone.prototype.run
    http://localhost:4200/polyfills.js:6730:24
    ./node_modules/@angular/core/fesm5/core.js/NgZone.prototype.runOutsideAngular
    core.js:3779
    onHandleError
    core.js:3842
    ./node_modules/zone.js/dist/zone.js/</ZoneDelegate.prototype.handleError
    http://localhost:4200/polyfills.js:6984:17
    ./node_modules/zone.js/dist/zone.js/</Zone.prototype.runGuarded
    http://localhost:4200/polyfills.js:6746:25
    _loop_1
    http://localhost:4200/polyfills.js:7269:21
    ./node_modules/zone.js/dist/zone.js/</</api.microtaskDrainDone
    http://localhost:4200/polyfills.js:7278:17
    drainMicroTaskQueue
    http://localhost:4200/polyfills.js:7194:13
    ./node_modules/zone.js/dist/zone.js/</ZoneTask.invokeTask
    http://localhost:4200/polyfills.js:7092:21
    invokeTask
    http://localhost:4200/polyfills.js:8132:9
    globalZoneAwareCallback
    http://localhost:4200/polyfills.js:8158:17

这是因为使用 onDestroy 以错误的方式取消订阅。

我试图取消订阅我创建的一些订阅,但由于某些奇怪的原因出错了,现在我已经修复了这个问题,routerLink 再次工作。