-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Firebase SDK should be a dependency since it's not required that
projects will install/use the SDK directly. And since Firebase uses
semver, the version restriction is more permissive. This means if the user
has installed Firebase already, npm is more likely to find a matching version.
From https://github.com/angular/angularfire2/blob/master/docs/1-install-and-setup.md
npm install angularfire2 firebase --save
Installing firebase currently resolves firebase@3.5.0, which is incompatible in some cases with 3.3.0.
Not listing firebase as a peerDependency gives me no warning that this is not the case, resulting in some headache.
Version info
Angular: ^2.0.0
Firebase: ^3.5.0
AngularFire: 2.0.0-beta.5
Test case
Example that doesn't work with different firebase versions:
import * as firebase from 'firebase';
import { AngularFire } from 'angularfire2';
@Injectable()
export class TestService {
constructor(private af: AngularFire) {
this.af.auth.subscribe(user => {
//Following line will fail since I'm sending an object created with firebase@3.5.0 into firebase@3.3.0, which are not compatible
user.auth.linkWithPopup(new firebase.auth.GoogleAuthProvider());
}
}
}
So, why isn't firebase a peerDependency? It seems quite crucial that the versions are the same for some use cases.