Function calls not supported error

defaultFirebase, firebaseAuthConfig function calls are not supported.


I am able to run the code using ionic serve, see it in ionic view app but ionic build android is not working.
Help me out from this error.

login.ts:

import { Component } from ‘@angular/core’;
import { NavController, LoadingController, AlertController } from ‘ionic-angular’;
import { FIREBASE_PROVIDERS,
AngularFire,
AuthMethods,
AuthProviders,
defaultFirebase,
firebaseAuthConfig,
FirebaseAuth } from ‘angularfire2’;
import { HomePage } from ‘…/home/home’;
import { ForgotPage } from ‘…/forgot/forgot’;

@Component({
selector: ‘page-login’,
templateUrl: ‘login.html’,
providers: [
FIREBASE_PROVIDERS,
defaultFirebase({
apiKey: ‘',
authDomain: '
’,
databaseURL: ‘',
storageBucket: '

}),
firebaseAuthConfig({
provider: AuthProviders.Password,
method: AuthMethods.Password
})
]
})
export class LoginPage {

loginEmail;
loginPassword;

constructor(public navCtrl: NavController, public auth: FirebaseAuth, public laodingCtrl: LoadingController, public alertCtrl: AlertController) {}

ionViewDidLoad() {
console.log(‘Hello LoginPage Page’);
}

public loading(){
let laod = this.laodingCtrl.create({
content: ‘Please wait…’
});
laod.present();
setTimeout(()=>{
laod.dismiss();
},2000);
}

public signin(credentials){
this.loginEmail = credentials.email;
this.loginPassword = credentials.password;
this.loading();
firebase.auth().signInWithEmailAndPassword(this.loginEmail, this.loginPassword).then((loginData)=>{
var user = firebase.auth().currentUser.emailVerified;
if(user){
this.navCtrl.setRoot(HomePage);
}else{
let alert = this.alertCtrl.create({
title: ‘Verfication failed’,
subTitle: ‘Verify your account to proceed.’,
buttons: [‘Ok’]
});
alert.present();
}
},(error)=>{
let alert = this.alertCtrl.create({
title: ‘failed’,
subTitle: error.message,
buttons:[‘OK’]
});
alert.present();
});
}

public register(credentials){
this.loginEmail = credentials.email;
this.loginPassword = credentials.password;
this.loading();
firebase.auth().createUserWithEmailAndPassword(this.loginEmail,this.loginPassword).then((registerData)=>{
var user = firebase.auth().currentUser;
user.sendEmailVerification().then((verficationData)=>{
let alert = this.alertCtrl.create({
title: ‘Verify’,
subTitle: ‘Link has been mailed.’,
buttons: [{
text: ‘OK’,
handler: ()=>{
this.navCtrl.setRoot(LoginPage);
}
}]
});
alert.present();
},(error)=>{
let alert = this.alertCtrl.create({
title: ‘Failed’,
subTitle: error.message,
buttons: [‘OK’]
});
alert.present();
})
},(error)=>{
let alert = this.alertCtrl.create({
title: ‘Failed’,
subTitle: error.message,
buttons: [‘OK’]
});
alert.present();
});
}

public forgotPassword(){
this.navCtrl.push(ForgotPage);
}

}


output:

ionic-hello-world@ ionic:build D:\ionic2\BarcodeDatabase
ionic-app-scripts build

[14:37:53] ionic-app-scripts 0.0.45
[14:37:53] build prod started …
[14:37:53] clean started …
[14:37:53] clean finished in less than 1 ms
[14:37:53] copy started …
[14:37:53] ngc started …
[14:37:53] copy finished in 156 ms
[14:37:57] Error: Error encountered resolving symbol values statically. Calling function ‘firebaseAuthConfig’, function
calls are not supported. Consider replacing the function or lambda with a reference to an exported function,
resolving symbol LoginPage in D:/ionic2/BarcodeDatabase/.tmp/pages/login/login.ts, resolving symbol
LoginPage in D:/ionic2/BarcodeDatabase/.tmp/pages/login/login.ts
[14:37:57] ngc failed
[14:37:57] ionic-app-script task: “build”
[14:37:57] Error: Error

npm ERR! Windows_NT 10.0.14393
npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “run” “ionic:build” “–”
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world@ ionic:build: ionic-app-scripts build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world@ ionic:build script ‘ionic-app-scripts build’.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ionic-hello-world
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! D:\ionic2\BarcodeDatabase\npm-debug.log

@tm_vishal did you find a way around this?
I too am hitting this error in release build only. ionic serve works fine, but adding the --prod causes this cryptic error about the function firebaseAuthConfig

Any help appreciated!

@randbrown yes!! There is a different way to do that. Firebase defaults must be defined in ionic.module.ts.
https://www.youtube.com/shared?ci=utuOyAFa-Xc
Go through that video.

Did you resolve this issue? I’m having a hard time solving it prior to building in production mode. Works in non-production mode.