Ionic 2 rc 2.0.0 angualr fire 2 issue


#1

hi,

I am trying to make angularfire2 work with latest ionic rc 2.0.0.
npm install angularfire2 firebase --save worked very well.

but when i do ionic serve

getting below error
D:\Tushar\Projects\ionic2Sample>ionic serve

Running ‘serve:before’ npm script before serve

ionic-hello-world@ watch D:\Tushar\Projects\ionic2Sample
ionic-app-scripts watch
[12:27:27] ionic-app-scripts 0.0.23
[12:27:27] watch started …
[12:27:27] build dev started …
[12:27:27] clean started …
[12:27:27] clean finished in 16 ms
[12:27:27] copy started …
[12:27:27] typescript compiler started …
[12:27:27] lint started …
[12:27:27] copy finished in 97 ms
[12:27:28] lint finished in 1.02 s
[12:27:41] Error: Module D:\Tushar\Projects\ionic2Sample\node_modules\angularfi
re2\node_modules\firebase\firebase-browser.js does not export initializeApp (imp
orted by D:\Tushar\Projects\ionic2Sample\node_modules\angularfire2\angularfire2.
js)
at Module.trace (D:\Tushar\Projects\ionic2Sample\node_modules\rollup\dist\ro
llup.js:7677:29)
at ModuleScope.findDeclaration (D:\Tushar\Projects\ionic2Sample\node_modules
\rollup\dist\rollup.js:7300:22)
at Scope.findDeclaration (D:\Tushar\Projects\ionic2Sample\node_modules\rollu
p\dist\rollup.js:5351:39)
at CallExpression.bind (D:\Tushar\Projects\ionic2Sample\node_modules\rollup
dist\rollup.js:5826:28)
at D:\Tushar\Projects\ionic2Sample\node_modules\rollup\dist\rollup.js:5151:5
0
at ReturnStatement.eachChild (D:\Tushar\Projects\ionic2Sample\node_modules\r
ollup\dist\rollup.js:5168:5)
at ReturnStatement.bind (D:\Tushar\Projects\ionic2Sample\node_modules\rollup
\dist\rollup.js:5151:7)
at BlockStatement.bind (D:\Tushar\Projects\ionic2Sample\node_modules\rollup
dist\rollup.js:5617:9)
at FunctionDeclaration.bind (D:\Tushar\Projects\ionic2Sample\node_modules\ro
llup\dist\rollup.js:6405:13)
at ExportNamedDeclaration.bind (D:\Tushar\Projects\ionic2Sample\node_modules
\rollup\dist\rollup.js:6223:44)

[12:27:32] typescript compiler ready in 5.40 s
[12:27:32] bundle dev started …
[12:27:41] sass started …
[12:27:43] sass finished in 2.19 s
[12:27:43] build dev finished in 15.96 s
[12:27:43] watch ready in 16.02 s
Running live reload server: http://localhost:35729
Watching: www//*, !www/lib//, !www/**/.map
√ Running dev server: http://localhost:8100
Ionic server commands, enter:
restart or r to restart the client app from the root
goto or g and a url to have the app navigate to the given url
consolelogs or c to enable/disable console log output
serverlogs or s to enable/disable server log output
quit or q to shutdown the server and exit
ionic $

app.module.ts
export const firebaseConfig = {
apiKey: ‘xxx’,
authDomain: ‘xxx’,
databaseURL: ‘xxx’,
storageBucket: ‘xxx’
};
@NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage
],
imports: [
BrowserModule,
AngularFireModule.initializeApp(firebaseConfig),
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage
],
providers: []
})
export class AppModule { }

is it something related to angular fire 2 ?


#2

Same thing happens to me


#3

Yes, please, any help?


#4

I’ve found this:

But, I have a new issue now:

rollup: Use of `eval` (in /Users/me/project/node_modules/angularfire2/node_modules/firebase/firebase.js) is strongly discouraged, as it poses security risks and may cause issues with minification. See https://github.com/rollup/rollup/wiki/Troubleshooting#avoiding-eval for more details

#5

this worked for me: https://github.com/angular/angularfire2/issues/565#issuecomment-250153841, BUT it breaks the watch script, and ionic serve will no longer refresh JS / HTML changes until you restart it


#6

The first solution looks better, but you need to deactivate the use strict mode at least by now to use firebase…

Now my issue is after import Storage:

 Error: Module /Users/me/project/node_modules/@ionic/storage/di
st/es5/index.js does not export Storage (imported by /Users/me/project/.tm
p/app/app.module.js)  

:S


#7

The solutions work fine for the ionic serve thanks !
But did someone manage to have it work for iOS ?

I tried to ionic build ios then import the project in Xcode, then the simulator crashed and shows white screen…
I’m new to Ionic and didn’t manage to have the ionic run ios to launch the emulator automatically!


#8

Please, check this example:
https://playcode.org/getting-started-with-ionic-2-rc0-firebase-3-angularfire-2/


#9

It works perfectly for me ! Thank you so much @Corin !


#10

This worked for me, Thanks +1 :slight_smile:


#11

Thanks +1. Perfectly for me.


#12

Thank you! It works, but the log with eval still remains!


#13

Check this out. It contains useful information and samples on how to get angularfire2 fully configured