question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Switch out @apollo/client for smaller bundle size

See original GitHub issue

I ripped out @apollo/client from @redwoodjs/web and implemented a super basic graphql client on my own instead. I then created two RW apps with the two different graphql clients to compare sizes

With @apollo/client

$ du -s web/dist/
1980    web/dist/

With the custom RW client

$ du -s web/dist/
1084    web/dist/

So almost half the bundle size just by switching out our graphql client. I think it’s worth thinking about what we really need/want to ship by default. With the (hopefully) coming possibility for our users to wire up RW to use whatever gql client they want, maybe we don’t need such an advanced and fully featured client as apollo bundled up with the framework itself.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
jpvajdacommented, May 16, 2022

@Tobbe 👋 I was reviewing this issue and though it’s older, it’s still very relevant of a topic for us at Apollo GraphQL, as we’ve had others asking us about the total bundle size of Apollo Client and have raised concerns about it’s size. I’m actually the Staff Product Manager of Apollo Client, and I’d be deeply interested in learning where this particular change is at for RedwoodJS and if there is any specific feedback we could gather from you as it relates to Apollo Client. We’d love to keep Apollo Client as part of the core offering of RedwoodJS, so any feedback you can share would be awesome for us to hear.

I’d be happy to setup some time to discuss further or we can have any async conversation. I’m also including the Client engineering team on this issue as they are always open to feedback and happy to answer any questions.

cc @benjamn @hwillson @brainkim

1reaction
NetLancercommented, Sep 22, 2022

I personally thought about bundle size decrease by swapping for preact, and it appeared that urql claims to have good charasteristics + supports preact,so preact & urql options would be great to have, the solution i’ve been googling for ))

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apollo Client 2.0 - Apollo GraphQL Blog
Apollo Client is the ultra-flexible, community-driven GraphQL ... apps to see around a 30kb total bundle size for all of their data needs....
Read more >
Why use Next.js with Apollo - LogRocket Blog
There are three key reasons to use the Apollo Client: Out-of-the-box support for caching; Inbuilt loading and error states; Declarative approach ...
Read more >
Reduce abnormally high bundle size - Stack Overflow
My bundle size for a small single-page React project is abnormally high ... In actuality, webpack output says the bundle size is 27Mb...
Read more >
Chakra UI Component Library, Next.js, & GraphQL With Apollo ...
... out our podcast application. We also cover using Apollo Client for GraphQL queries and mutations and how to implement optimistic UI with...
Read more >
10 Tips & Tricks for smaller bundles in React apps - ITNEXT
I'm confident that after reading this article you will be able to reduce your bundle size by at least 5–10%, since I'll start...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found