When compiling Angular project with latest version of Angular CLI it throws below warning:
node_modules\@angular\fire\__ivy_ngcc__\fesm2015\angular-fire.js depends on firebase/app. CommonJS or AMD dependencies can cause optimization bailouts.
node_modules\firebase\app\dist\index.cjs.js depends on @firebase/app. CommonJS or AMD dependencies can cause optimization bailouts.
Google advises against using CommonJS modules because it can impact the tree-shaking of application as explained here https://web.dev/commonjs-larger-bundles/
I would therefore request you to please release this plugin as es2015 module.
Thank you
same here on Angular 10
This library is released as es2015 and abides by APF, however Firebase JS SDK does not abide by APF. The JS SDK's main package is a CJS whereas APF expects it to be a UMD. We can't change that until at least the next major. Please raise any issues related to the JS SDK over here.
In the meantime, I've been developing a possible work-around for Angular developers using ngcc.config.js which allows one to override the package.json for modules. This seems to be working much better for me in NG 10 but spits out a lot of errors as many of the Firebase JS SDK sub-packages are referencing the same .d.ts files, with ngcc is not happy about.
If we make it so firebase and firebase/app aren't sharing index.d.ts and the rest of the JS SDK modules aren't sharing the same empty-import.d.ts then ngcc shouldn't complain quite so loudly with my ngcc.config.js; at that point I'd consider documenting it and adding it to the ng add schematic.
Closing as it's not an issue with AngularFire, feel free to continue discussing. Pinning since I expect a lot of duplicate issues here.
FYI @Feiyang1 @StephenFluin
Thank you so much @jamesdaniels for explaining this, I'd wait for your possible work-around and will also post it on https://github.com/firebase/firebase-js-sdk .
Here's the link to feature request on firebase-js-sdk https://github.com/firebase/firebase-js-sdk/issues/3315
Most helpful comment
Here's the link to feature request on
firebase-js-sdkhttps://github.com/firebase/firebase-js-sdk/issues/3315