@wesleydev I don’t think you should use AngularFire for a production application at this point, It is beta… does not support storage and the APIs are still changing as we speak… Unless there is a compelling reason, I would stick with Firebase
I was able to use both AF2 and Firebase with beta 11 and there is a way to do the same with rc0. I’m still converting my app so haven’t done it myself yet but someone was able to do it in ionic slack.
you can load the typescript files from the fiebase node package… it is a hack, but it will work. Also you don’t necessarily need the definitions for the application to work
If you could provide instructions on how to properly load the type definition files for Firebase 3 on a Ionic rc.0 project that would be lovely and people would be grateful. I’ve tried all I could think of but I always get console errors.
Hi all, so this is what I got working from playing around it. I did not use AngularFire 2.
Start a new project ionic start myapp blank --v2
Install firebase as normal. The new TypeScript def is actually already included. npm install firebase --save
Then under node_modules@ionic\app-scripts\config\rollup.config.js, add the following as many has suggested. useStrict: false,
Then import firebase as I normally use do, but instead use: import firebase from 'firebase';
Then just set it up as normal with your firebase config and it works fine. I tried in both devices and web browser. There is a lot of ‘eval’ warning, but I think they can be ignored since its a function that firebase library use and rollup does not like it? (any comments from experts?)
After injecting AngularFire in the constructor I get several “Network Error” messages. I’m testing on a iOS 10 simulator. The same happens when I use just Firebase.
Did you tried Firebase SDK with a blank project? Does that work on its own? I haven’t fully ported my entire project yet, but doing it bit by bit from the blank project. See if that helps.
The type definition seems to be already included as part of the package when I run the npm install firebase --save
If I navigate to node_modules\firebase. There is a file there already firebase.d.ts. I matched it with AngularFire 2 and it is the same one. And typescript/ionic loads it automatically it seems. I do not need to do any typing install command.
This seems to hold true for other third party lib too. I first noticed this when I tried to install moment library, it works out of the box without any typing install and found that there is also a type defintion there. So I think as long as the type defintion is in the node module, it will work automatically. (Again, I am no expert in this matter, if some matter expert can verify my findings that would be great )
The only difference between firebase library and moment library that I can tell is that firebase uses eval() (which rollup does not like) and fail on strict mode (which rollup is at). So I just disable strict mode, and I ignore eval warning as I feel firebase team knows what they are doing with eval() and won’t pose any security risk as rollup warning suggest.