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

[docs] Update explainer around reducing-bundle-size #11791

Merged
merged 7 commits into from
May 13, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/source/development-testing/reducing-bundle-size.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Reducing bundle size
description: Squeeze those last few bytes out of your production build
---

Two quick configuration changes can help you reduce your bundle size: turning off Apollo Client's development mode and picking a consistent style for your imports.
Some quick configuration changes can help you reduce your bundle size: turning off Apollo Client's development mode and picking a consistent style for your imports.
Every byte counts in optimizing your app's performance.
phryneas marked this conversation as resolved.
Show resolved Hide resolved

## Turning off development mode
Expand Down Expand Up @@ -184,3 +184,11 @@ It is important to keep in mind though that bundlers are complex and it might ma
Every bundling setup is different and we cannot guarantee which style results in the smallest bundle size. We recommend trying out these styles in a small setup to determine which results in the best outcome in your environment.

**Note:** some entry points are not part of the "main" entrypoint `'@apollo/client'` and can only be imported directly (e.g. from `'@apollo/client/link/batch'`). It's perfectly fine to use these, even when using the "main" entrypoint.
phryneas marked this conversation as resolved.
Show resolved Hide resolved

## Why have a larger library in the first place?

### What you get
Apollo Client is more than just a simple data fetcher: it is a request/response cache, state manager, and React component integration. Attempting to build a comparable experience to Apollo Client with other libraries would require you to write custom logic, libraries, and components wrappers. Scaling that out to all the components in your application would easily lead to a larger bundle and doing so with a custom and difficult to understand implementation that needs to be maintain by your team. By choosing Apollo Client, you hand off that ownership to a trusted team building Open Source Software since 2016.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this! Only other thing I'd add to that list of what Apollo Client is is adding something about testing utilities as well. I think that is also an important part of the library and is definitely not something you will ever see in a production bundle.


### Next major version
Apollo Client v3 supports a large range of browser compatibility, back to IE11. In our next major version we plan to raise those targets which will allow us to remove included polyfills and as well as clean up deprecated features.
phryneas marked this conversation as resolved.
Show resolved Hide resolved
Loading