Skip to content

Instantly share code, notes, and snippets.

@romanonthego
Last active July 2, 2017 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romanonthego/5b6fd14afe7c1ace671692d8b8472097 to your computer and use it in GitHub Desktop.
Save romanonthego/5b6fd14afe7c1ace671692d8b8472097 to your computer and use it in GitHub Desktop.
// require with Promise wrapper / dynamic import()
import importFirebase from 'firebaseImport'
export default function firebase() {
return importFirebase().then((firebase) => {
// do that ever you need here.
// something like:
const app = firebase.initializeApp({
apiKey: '<your-api-key>',
authDomain: '<your-auth-domain>',
databaseURL: '<your-database-url>',
storageBucket: '<your-storage-bucket>',
messagingSenderId: '<your-sender-id>'
})
// return actully usable objects:
return {
database: app.database()
auth: app.auth()
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment