更新angularCli后要编译的问题

时间:2019-02-07 15:17:01

标签: angular angularfire2

更换计算机,然后安装最新的角度版本Cli,现在我的项目给我这个错误,我在互联网上找不到信息。

ERROR in ./node_modules/@angular/fire/messaging/messaging.js 23:40
Module parse failed: Unexpected token (23:40)
You may need an appropriate loader to handle this file type.
|         var _this = this;
|         if (isPlatformBrowser(platformId)) {
>             var requireMessaging = from(import('firebase/messaging'));
|             this.messaging = requireMessaging.pipe(map(function () { return _firebaseAppFactory(options, nameOrConfig); }), map(function (app) { return app.messaging(); }), runOutsideAngular(zone));
|             this.requestPermission = this.messaging.pipe(switchMap(function (messaging) { return messaging.requestPermission(); }), runOutsideAngular(zone));

2 个答案:

答案 0 :(得分:0)

Found some info in the Angularfire2 docs

Looks like the issue is with the default Angular service worker not supporting the AngularFirebaseMessaging.

AngularFireMessaging is not compatible with the Angular Service Worker

If you are using the Angular Service Worker, you are not currently able to use AngularFireMessaging. If you'd like this feature please file an issue in either repository. Your alternatives are to use WorkboxJS or just simply use the Firebase Messaging Service Worker, which is detailed below

答案 1 :(得分:0)

检查依赖关系,并一一解决。主要关注

  • @angular-devkit/build-angular版本从^0.13.9降级到^0.12.4