One change: from
import * as firebase from 'firebase';
to
import {firebase} from 'firebase';
enough for your example to work with firebase 3.6.
However, I would say that this works by chance. firebase.jsnot like a module at all, it does not use module.exportsor amd define, it just creates a global variable firebasewith the following properties:
INTERNAL: Object
Promise: Promise()
SDK_VERSION: "3.6.4"
User: (a, b, c)
__esModule: true
app: a(a)
apps: (...)
get apps: ()
auth: (c)
database: (c)
default: Object
initializeApp: (a, c)
messaging: (c)
storage: (c)
__proto__: Object
Perhaps this is the presence __esModulethat causes SystemJS to wrap it in another object - if you look in the debugger as a result import * as firebase from 'firebase', it contains one property, also called firebase, which is the actual module that you need.
Interestingly, it is firebase.d.tswritten in such a way that
import {firebase} from 'firebase';
firebase.initializeApp(...);
works, but seemingly equivalent
import * as firebase from 'firebase';
firebase.firebase.initializeApp(...);
not checked typecheck.
artem source
share