Skip to content

Bundle Size Optimisation #5319

Answered by TkDodo
Kazumz asked this question in Q&A
Apr 24, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

You are always importing the QueryClient, because you need to create one in your App to pass it to the <QueryClientProvider>. The QueryClient is a class, which cannot be tree-shaked. bundlejs shows that you'll get about 10.44kb gzipped when importing useQuery, QueryClient, QueryClientProvider, useQueryClient. That's likely the bare minimum that you need.

In v5, we'll drop about 10% bundle size due to no longer supporting legacy browsers, thus we can minify better by using modern features like private class fields.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Kazumz
Comment options

Answer selected by Kazumz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants