Firebase + webpack


#1

I was able to webpack everything in my angular app (with help from Stanimira Vlaeva on GitHub), but I can’t get the firebase plugin to cooperate. I’m getting firebase is not defined.
Firebase is wrapped in an angular service and I am initializing it in my first component. Solution mentioned here didn’t help me.
I am importing firebase like so:

import firebase = require("nativescript-plugin-firebase");

And using it like so:

@Injectable
export class FirebaseService {
initialize() {    
    firebase.init({
            ...
        })
    }

and in my component this.firebaseService.initialize();

This works fine without AOT, it’s the last thing keeping me from going to production with my app.


#2

@eddy I have also had a lot of trouble with Firebase and webpack. Is there anything obvious holding us back? For me, as I remember, the app would build with webpack but then crash on device, quite hard to debug.


#3

I’m a total webpack noob. Anyone else perhaps?


#4

Importing the plugin this way:
import * as firebase from "nativescript-plugin-firebase"
instead of the way it’s mentioned on github
import firebase = require("nativescript-plugin-firebase");
worked

(Although I was able to webpack the app, I am still a webpack noob, it’s all trial and error for me)