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

improve: Optimised imports from graphql to decrease bundle size #543

Merged

Conversation

VrajKD
Copy link
Contributor

@VrajKD VrajKD commented Jun 9, 2023

Description

While integrating graphql-request into a project to replace apollo-client, on analyzing the bundles created by webpack, I saw that graphql as a dependency itself is taking up a bit more than 500Kib in the chunk generated by webpack.

One of the major pros towards opting for graphql-request was its minimal bundle size, and with just these more specific imports, we end up saving close to 300KiB directly. Projects with webpack 4 and some legacy packages would be able to have these smaller bundles as well with this minor refactor

Screenshots

Before After

Copy link
Member

@jasonkuhrt jasonkuhrt left a comment

Choose a reason for hiding this comment

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

Thanks! Can you please add some code comment with link to this PR. No way the significance of this change will be retained in the future. Also if you can add a bundle size check to CI that would be great to avoid future regressions.

@VrajKD
Copy link
Contributor Author

VrajKD commented Jun 12, 2023

Thanks! Can you please add some code comment with link to this PR. No way the significance of this change will be retained in the future. Also if you can add a bundle size check to CI that would be great to avoid future regressions.

Have added a code comment with the imports for reference. Adding a bundle size check is a nice idea as well, I'll read more on it and try and work on it separately 👍

Copy link
Member

@jasonkuhrt jasonkuhrt left a comment

Choose a reason for hiding this comment

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

Thanks!

@jasonkuhrt jasonkuhrt changed the title improvement: Optimised imports from graphql to decrease bundle size improve: Optimised imports from graphql to decrease bundle size Jun 15, 2023
@jasonkuhrt jasonkuhrt merged commit e5c8e7f into graffle-js:main Jun 15, 2023
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

Successfully merging this pull request may close these issues.

2 participants