Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use default import for firebase #2079

Merged
merged 2 commits into from
May 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/firestore/firestore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import { AngularFirestoreCollection } from './collection/collection';
import { FirebaseFirestore, FirebaseOptions, FirebaseAppConfig, FirebaseOptionsToken, FirebaseNameOrConfigToken, _firebaseAppFactory, FirebaseZoneScheduler } from '@angular/fire';
import { isPlatformServer } from '@angular/common';

import { firestore, SDK_VERSION } from 'firebase/app';
// Workaround for Nodejs build
// @ts-ignore
import firebase from 'firebase/app';

// SEMVER: have to import here while we target ng 6, as the version of typescript doesn't allow dynamic import of types
import { firestore } from 'firebase/app';

/**
* The value of this token determines whether or not the firestore will have persistance enabled
Expand All @@ -19,8 +24,8 @@ export const PersistenceSettingsToken = new InjectionToken<PersistenceSettings|u
export const FirestoreSettingsToken = new InjectionToken<Settings>('angularfire2.firestore.settings');

// timestampsInSnapshots was depreciated in 5.8.0
const major = parseInt(SDK_VERSION.split('.')[0]);
const minor = parseInt(SDK_VERSION.split('.')[1]);
const major = parseInt(firebase.SDK_VERSION.split('.')[0]);
const minor = parseInt(firebase.SDK_VERSION.split('.')[1]);
export const DefaultFirestoreSettings = ((major < 5 || (major == 5 && minor < 8)) ? {timestampsInSnapshots: true} : {}) as Settings;

/**
Expand Down