0

I'm having a hard time trying to update my project to Angular 10 from Angular 8. Everything is working fine, but Firebase Analytics from @angular/fire. It always returns: "loading chunk firebase-analytics failed.".

I'm not sure if it related to the given package or some other configuration that is incorrect.

There were some errors at the terminal about ES modules, which I added to allowedCommonJsDependencies at Angular.json, to skip compiling them, yet with no changes.

One thing that I find weird yet I'm not sure if is normal is that the analytics is not bundled together on the vendor chunk.

Would really appreciate any insights, thanks!

The errors that happens:

console

The bundles from the build:

enter image description here

Angular.json:

enter image description here

Package versions:

enter image description here

Kousenlsn
  • 19
  • 3

1 Answers1

0

I would recommend updating first to Angular 9 so the update schematic can handle any breaking change for you, then update again to Angular 10.

Regarding Firebase analytics from angularfire, would be good to check your module imports, should be something like:

import { NgModule, Injectable } from '@angular/core';
import { AngularFireAuthModule } from '@angular/fire/auth';
import { AngularFireFunctionsModule } from '@angular/fire/functions';
import { AngularFireMessagingModule } from '@angular/fire/messaging';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { AngularFireStorageModule } from '@angular/fire/storage';

@Injectable()
@NgModule({
  imports: [
    AngularFireAuthModule,
    AngularFireFunctionsModule,
    AngularFireMessagingModule,
    AngularFirestoreModule,
    AngularFireStorageModule,
    // Other module imports
  ],
})
export class AppModule {}

One thing you could do is starting a new project and add only angular/fire to see if it is something related to the Angular update itself.

KingDarBoja
  • 1,033
  • 6
  • 12
  • I tried to create a new Angular 10 project with only Firebase / Angular/fire and using the analytics, and the same error occurs, looks like related exclusively to it. They don't support Angular 10 it seems. – Kousenlsn Aug 25 '20 at 13:08
  • Seems to be a issue on latest version: https://github.com/angular/angularfire/issues/2464. In the worst scenario, you could try lowering the version to v5.x.x and check again. If doesn't work, please open a new issue on angularfire repository. – KingDarBoja Aug 25 '20 at 13:14
  • 1
    Yeah, on the release 6.0.2 it states it works for Angular10, but I'm playing around now with different versions of Angular/fire and Angular. But I will open an issue there either way. Thanks! – Kousenlsn Aug 25 '20 at 13:25