Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request - Release this plugin as ES2015 module #2478

Closed
naveedahmed1 opened this issue May 26, 2020 · 5 comments
Closed

Feature Request - Release this plugin as ES2015 module #2478

naveedahmed1 opened this issue May 26, 2020 · 5 comments

Comments

@naveedahmed1
Copy link

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

@rodolfojnn
Copy link

same here on Angular 10

@jamesdaniels
Copy link
Member

jamesdaniels commented Jun 26, 2020

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.

@jamesdaniels jamesdaniels pinned this issue Jun 26, 2020
@jamesdaniels
Copy link
Member

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

@naveedahmed1
Copy link
Author

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 .

@naveedahmed1
Copy link
Author

Here's the link to feature request on firebase-js-sdk firebase/firebase-js-sdk#3315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants