0

So i'm using the official documentation to setup and install angularfire2. https://github.com/angular/angularfire2/blob/master/docs/install-and-setup.md

This works fine, my data is coming in but when building for production i get this error:

It looks like you're using the development build of the Firebase JS SDK. When deploying Firebase apps to production, it is advisable to only import the individual SDK components you intend to use.

For the CDN builds, these are available in the following manner (replace with the name of a component - i.e. auth, database, etc):

I tried every suggestion out there but nothing is working.

Any Ideas? thx,

Root module

import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';

import { RootComponent } from './rootComponent.component';
import { ROOT_ROUTES } from './root.routes';
import { BrowserModule, Title } from '@angular/platform-browser';
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { environment } from '../environments/environment';

@NgModule({
  declarations: [RootComponent],
  imports: [
    AngularFireModule.initializeApp(environment.firebase),
    AngularFirestoreModule,
    NoopAnimationsModule,
    BrowserModule,
    RouterModule.forRoot(ROOT_ROUTES)
  ],
  providers: [Title],
  bootstrap: [RootComponent]
})
export class RootModule {}

Component

import { Component, OnInit } from '@angular/core';
import { MatTableDataSource } from '@angular/material';
import { AngularFirestore } from '@angular/fire/firestore';
import { Observable } from 'rxjs';
import { ActivatedRoute } from '@angular/router';
import { Seal } from '../seals.types';
import { StudioService } from '../../../service/studio.service';

@Component({
    selector: 'seals-component',
    templateUrl: './seals.component.html'
})
export class SealsComponent implements OnInit {

    constructor(private db:AngularFirestore, private studioService: StudioService) {
        this.getData();
    }

    items: Observable<any[]>;
    dataSource = new MatTableDataSource<Seal[]>();;
    displayedColumns: string[] = ['description', 'language', 'seal', 'type'];
    pID:string = 'flsjezlijlsfj';

    ngOnInit() {}

    getData() {
        this.items = this.db.collection(`sealsDB/TNDorQMQOzoqY6P6Ej0i/seal/${this.pID}/seal/`).valueChanges();
        this.items.subscribe(seals => {
            this.dataSource.data = seals
        })
    }
}
kevinius
  • 4,232
  • 7
  • 48
  • 79

1 Answers1

0

I was having the same warning and it took me a while to figure it out that I was using the User interface from firebase/auth, along with Timestamp.fromDate() in other file.

So I added:

import * as firebase from 'firebase/app';
import { User } from 'firebase/auth';

and just

import * as firebase from 'firebase/app';

where I used

firebase.firestore.Timestamp.fromDate()

This got rid of the warning.

emiyasaki
  • 48
  • 2
  • 6