-
Notifications
You must be signed in to change notification settings - Fork 900
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
Firestore import - Bundle size is huge #2241
Comments
I found a few problems with this issue:
|
This way you will only import what corresponds to Firestore
|
Nope. The size is +36B increased after adding the above code. |
@AutanaSoft see #332 |
@maheshkumar2150 Thanks for reporting! We are aware that there is a lot of room for improvement and are planning to prioritize reducing the SDK size in the very near future. |
In the mean time, is there any solution?
Because of firestore import, the bundle size is huge and loading time is increased and started to lose visitors on my site. I think firestore is not an optimal solution to websites and webapps right now. If there is any solution, please tell me to reduce the size. |
Hi Can you please suggest me how to make backup firestore data and implement it in mongodb? Google analytics shows the app takes around 1 min to load for the first time which is really bad. |
@maheshkumar2150 We currently don't have a MongoDb specific export functionality. Please take a look here to see if this works for you: https://firebase.google.com/docs/firestore/manage-data/export-import |
Hi What is dedicated feature request? Is something like that possible? Or do i have to import the whole firestore package? |
Hi I am thinking to convert the reactjs application to next.js Is it possible to use firestore in node server? |
Our Node module for Servers is https://www.npmjs.com/package/@google-cloud/firestore |
"1 min to load for the first time" 😨 |
I am using firebase hosting and firebase firestore. What are my chances? Is it easy to move the firebase hosting to zeit hosting? Right now, the app is designed with reactjs. Is this the right solution? |
@maheshkumar2150 I am not sure I fully follow, but our Server SDKs can run on any Node 8 environment. |
Hi, Thanks. I am actually coded the app using create-react-app. Now, I am converting the app to server side rendering. So i can reduce the firebase SDK size. I have just checked Firebase Rest API. |
I believe that would only work if you don't have any security rules, which would not be recommended for a production app. |
Bundle size is the only drawback I've encountered (and it is a major one to me) with Firebase and it's great to hear that this is coming up in priority! |
@pjbrown11 I could make the size less annoying by using firebase (auth+firestore) in a worker thread: see #983 |
Interesting approach. Thanks for sharing! |
Good. Actually i am using code splitting and firebase is not loaded on my homepage. Everyone is using react, angular or other frameworks which itself little big for web apps. Adding firebase completely spoils the size. We need reduced firebase sdk. That is the permanent solution. Please give high priority and reduce the bundle size. |
+1 ! Firebase sdk currently taking up 453 kb of space on my app. that's almost as big as just about everything else combined in a create-react-app app |
Same for me - the pages are quite small, but with firestore included, my app folder gets quite big.. |
I love Firebase but it's crazy right now guys, firestore + auth is ~500kb of bundle. |
@schmidt-sebastian is there a roadmap for reducing the bundle size? I saw there is some progress in #2495, but I'd love some guidance on whether there's more coming - currently the bundle size makes it a non-starter for us, but if there's more substantial improvements coming I'd love to get started building on Firebase. |
When the mangled version of Firestore is released, our bundle size will go down by about 9% gzipped. We are also looking at releasing an ES6 only version (for our prebuilts that we push to CDN, since this can be done already using our NPM builds), which shaves of another 10%. Furthermore, we are looking at making offline persistence optional might again will have a similar amount of savings (as a rough estimate). We are also in the early stages of figuring out how we can best reduce the bundle size for Auth and might release a tree-shakeable version at some point that will allow you to only depend on the Auth providers that you need. |
Unfortunately not many changes since a year ago. I guess we have to be patient 😉 |
Along with the tree-shakeable client, we are also preparing a "Lite" SDK that uses the Rest API and will be much smaller in size, albeit without persistence or snapshot listeners. |
You can use my code. It’s open source 😉 |
@maheshkumar2150 not official but you can use my libs for that until the official one arrives. |
Good work. Just one doubt. Is it like api? Have you written/hosted this in any server? |
@maheshkumar2150 its a client side JS library, so other than including it in your bundle on the front end nothing else is needed. And it is very small and performs very well. I'm confident that in that regard there is not much to improve. |
Thank you so much. How genius you are! |
I am started to work with your library. |
Please, let's keep discussion on topic. There are many people on this thread that are listening for updates about the official libraries. Ongoing discussion about alternatives should take place elsewhere. |
I opened this issue on 2019 October. I am very happy the team is working to fix the problem. @samuelgozi is promising and i don't want any issue on apps until official is launched. I believe i am the one who is waiting for very long time for the officials to come up with the minimized size than others. Not taking this topic to off topic. Just two/three chats are not going to spoil and it might help others. |
This would be awesome. Will the Lite sdk encompass other firebase libraries aside from firestore? Namely auth as it has implications with Firestore security rules. |
Lite will work with Firebase Auth. |
I'm so excited that you guys are releasing an official "lite" version. Persistence and real-time are awesome features, but the majority of projects probably don't need them, and it doesn't feel great carrying all that weight around for no reason. It feels like the FB team is listening to developers and moving in the right direction. Appreciate cha. |
Firestore can be accessed with a Rest API:
|
Hey guys are there any news on this? @schmidt-sebastian Can you give an estimate about the file size of the upcoming version? Also it would be nice to know if you recommend using the current version of Firestore and then swapping to the new version (I'm asking because of breaking changes). Last and final question. Is the Real Time Database significant smaller? For my case, I could also go with Real Time Database. Thanks and have a nice day 👍 |
I need a couple more days to work on this and am waiting on some code reviews. We are currently going through performance reviews and hence everyone is 110% busy doing non-code work. Here are some size samples: getDoc (Lite): 40 kB (13 kB gzipped) vs. 309 kB today (85 kB gzipped) These are the bundle sizes of Firebase App + Firestore using ES5/IIEFE with Rollup & terser. As stated, Firebase Auth is not ready yet. I am still working on tearing |
hi how is it going? any news for us? |
Okay, here we go. Huge heads up: The release I am about to talk about is VERY experimental. We have not tested it thoroughly in any way. It does not work with Firebase Auth (as the auth rewrite is not yet ready), so we recommend testing against the Emulator. We only published this release now since I am going on vacation next week and you have all been waiting for years :) You can install the modular Firestore SDK from npm: Sample usage:
There are still some major TODOs to make the SDK more tree-shakeable, but at this point we are mostly looking for comments on the API surface. The best "documentation" is https://github.com/firebase/firebase-js-sdk/blob/master/docs-exp/index.md. You can also take a look at the TypeScript definition files https://github.com/firebase/firebase-js-sdk/blob/master/packages/firestore/lite-types/index.d.ts (Lite SDK) and https://github.com/firebase/firebase-js-sdk/blob/master/packages/firestore/exp-types/index.d.ts (Full SDK) We will also provide a compatibility layer that will allow you to migrate your code slowly from the existing API to the new API. |
enjoy your holiday, you deserve it! |
Any updates on the auth changes? |
@SpencerLawrenceBrown We have merged it into master, and is in the final stage before making an alpha release. Please stay tuned! |
@Feiyang1 Are the team waiting for FirebaseSummit on October 27-28 to release this update? |
@schmidt-sebastian @Feiyang1 any reason we have both this and #332 open? Maybe we should consolidate the discussion on #332 now that the |
yeah, we will track it in #332. Closing |
import firebase from '@firebase/app';
import '@firebase/firestore'; // this one is very very huge.
I am using only firestore in my app.
How to reduce the bundle size of firestore?
The text was updated successfully, but these errors were encountered: