Solvedangularfire Build error: This module is declared with using 'export ='
✔️Accepted Answer
I see...
What happens when you add these entries to compilerOptions
in tsconfig?
"compilerOptions": {
//....
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
},
Other Answers:
Can confirm that @angular/fire 6.0.5 and firebase@8.0.1 no longer receives the error, my solution was simply npm install firebase@latest
Ok I did a bit of digging and it seems the problem is not the angularfire rather the firebase library itself.
if you need to import firebase anywhere into your angularfire project, the firease.[whatever] is not accessible in the new versions anymore. The path has changed but it seems guys @google forgot to update the documentations.
Here is an example. Let's say you have this in your imports:
import * as firebase from 'firebase/app';
Now if you try to access anything inside firebase
as usual it will throw the error messages you shared above. For example this:
return firebase.firestore.FieldValue.serverTimestamp()
will return an error.
You have to add default
to the namespace - in firebase 7.x.x and 8.x.x - in order to make it work:
return firebase.default.firestore.FieldValue.serverTimestamp();
that applies everywhere you are referring to firebase
in your code.
+1 same result as @gbrits - all good after upgrade to @angular/fire@6.0.5
and firebase@8.0.1
+1 confirm firebase@8.0.1
works like a charm!
After updating to v6.0.4 from v6.0.3 I am getting the following error -
This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.
Setting
allowSyntheticDefaultImports: true
gives the following error:Version info
Angular:
10.2.1
Firebase:
7.24.0
AngularFire:
6.0.4
How to reproduce these conditions
Steps to set up and reproduce
Update to 6.0.4
Debug output
N/A
Log stack