简体   繁体   English

firebase-analytics 与 Angular 10,捆绑错误

[英]firebase-analytics with Angular 10, bundle errors

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.我很难将我的项目从 Angular 8 更新到 Angular 10。一切正常,但来自 @angular/fire 的 Firebase Analytics。 It always returns: "loading chunk firebase-analytics failed.".它总是返回:“加载块 firebase-analytics 失败。”。

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.有大约ES模块,这是我加入到终端的一些错误allowedCommonJsDependenciesAngular.json ,跳过没有改变编译它们,但。

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:发生的错误:

安慰

The bundles from the build:来自构建的包:

在此处输入图片说明

Angular.json:角度.json:

在此处输入图片说明

Package versions:包版本:

在此处输入图片说明

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.我建议先更新到 Angular 9,以便更新示意图可以为您处理任何重大更改,然后再次更新到 Angular 10。

Regarding Firebase analytics from angularfire , would be good to check your module imports, should be something like:关于来自angularfire Firebase 分析,检查您的模块导入会很好,应该是这样的:

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.您可以做的一件事是启动一个新项目并仅添加angular/fire以查看它是否与 Angular 更新本身相关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM