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 bundle size #63

Merged
merged 7 commits into from
Oct 31, 2022
Merged

Improve bundle size #63

merged 7 commits into from
Oct 31, 2022

Conversation

antho1404
Copy link
Member

@antho1404 antho1404 commented Oct 28, 2022

Project organization

Description

Reduce the bundle size by removing all the enums (99% useless) from the generated graphql file. These enums are now only present as types for typescript.

Results

Before After
Parsed size 4.08MB 2.28 MB
Analyse Screen Shot 2022-10-29 at 00 24 31 Screen Shot 2022-10-29 at 00 24 40
Build before
Page                                       Size     First Load JS
┌ λ /                                      523 B           960 kB
├   /_app                                  0 B             831 kB
├ ○ /404                                   194 B           831 kB
├ ● /account/edit                          482 B           959 kB
├ λ /account/wallet                        478 B           959 kB
├ λ /api/fees                              0 B             831 kB
├ λ /checkout/[id]                         607 B           960 kB
├ λ /create                                538 B           960 kB
├ λ /create/[type]                         703 B           960 kB
├ λ /explore                               585 B           960 kB
├ ● /login                                 495 B           959 kB
├ λ /notification                          449 B           959 kB
├ ● /referral                              582 B           960 kB
├ λ /tokens/[id]                           582 B           960 kB
├ λ /tokens/[id]/bid                       657 B           960 kB
├ λ /tokens/[id]/offer                     613 B           960 kB
├ λ /users/[id]                            636 B           960 kB
├ λ /users/[id]/bids                       680 B           960 kB
├ λ /users/[id]/bids/placed                656 B           960 kB
├ λ /users/[id]/bids/received              657 B           960 kB
├ λ /users/[id]/created                    612 B           960 kB
├ λ /users/[id]/offers                     681 B           960 kB
├ λ /users/[id]/offers/auction             650 B           960 kB
├ λ /users/[id]/offers/fixed               656 B           960 kB
├ λ /users/[id]/on-sale                    614 B           960 kB
├ λ /users/[id]/owned                      611 B           960 kB
├ λ /users/[id]/trades                     679 B           960 kB
├ λ /users/[id]/trades/purchased           659 B           960 kB
└ λ /users/[id]/trades/sold                657 B           960 kB
+ First Load JS shared by all              831 kB
  ├ chunks/framework-4019f8cb8b6a2384.js   42.1 kB
  ├ chunks/main-58a3e64937211147.js        31.4 kB
  ├ chunks/pages/_app-52e3bc77faf69416.js  756 kB
  ├ chunks/webpack-9f954ed34dfe5ea5.js     1.92 kB
  └ css/49308b1030cce437.css               421 B
Build after
Page                                       Size     First Load JS
┌ λ /                                      521 B           734 kB
├   /_app                                  0 B             701 kB
├ ○ /404                                   194 B           701 kB
├ ● /account/edit                          479 B           734 kB
├ λ /account/wallet                        476 B           734 kB
├ λ /api/fees                              0 B             701 kB
├ λ /checkout/[id]                         604 B           734 kB
├ λ /create                                534 B           734 kB
├ λ /create/[type]                         700 B           734 kB
├ λ /explore                               581 B           734 kB
├ ● /login                                 492 B           734 kB
├ λ /notification                          447 B           734 kB
├ ● /referral                              578 B           734 kB
├ λ /tokens/[id]                           579 B           734 kB
├ λ /tokens/[id]/bid                       654 B           734 kB
├ λ /tokens/[id]/offer                     610 B           734 kB
├ λ /users/[id]                            631 B           734 kB
├ λ /users/[id]/bids                       676 B           734 kB
├ λ /users/[id]/bids/placed                652 B           734 kB
├ λ /users/[id]/bids/received              653 B           734 kB
├ λ /users/[id]/created                    608 B           734 kB
├ λ /users/[id]/offers                     678 B           734 kB
├ λ /users/[id]/offers/auction             647 B           734 kB
├ λ /users/[id]/offers/fixed               652 B           734 kB
├ λ /users/[id]/on-sale                    611 B           734 kB
├ λ /users/[id]/owned                      607 B           734 kB
├ λ /users/[id]/trades                     676 B           734 kB
├ λ /users/[id]/trades/purchased           655 B           734 kB
└ λ /users/[id]/trades/sold                653 B           734 kB
+ First Load JS shared by all              701 kB
  ├ chunks/framework-4019f8cb8b6a2384.js   42.1 kB
  ├ chunks/main-58a3e64937211147.js        31.4 kB
  ├ chunks/pages/_app-61237222c23f59c6.js  626 kB
  ├ chunks/webpack-5e742c8308c72bd4.js     1.97 kB
  └ css/49308b1030cce437.css               421 B

Checklist

  • Update related changelogs

@vercel
Copy link

vercel bot commented Oct 28, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
storybook-components ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Oct 31, 2022 at 3:35AM (UTC)
storybook-templates ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Oct 31, 2022 at 3:35AM (UTC)

@vercel vercel bot temporarily deployed to Preview – storybook-templates October 28, 2022 17:39 Inactive
@vercel vercel bot temporarily deployed to Preview – storybook-components October 28, 2022 17:42 Inactive
@achampagnedev
Copy link
Contributor

Only comment is wondering if there was any other way to avoid hardcoding strings with the removal of enums?

@antho1404
Copy link
Member Author

These are not actually strings but types. You cannot put any random string, just the ones with the correct name, and this is correctly checked by typescript so no risk for errors ;).

@vercel vercel bot temporarily deployed to Preview – storybook-templates October 31, 2022 03:32 Inactive
@vercel vercel bot temporarily deployed to Preview – storybook-components October 31, 2022 03:35 Inactive
@antho1404 antho1404 merged commit 465bfed into main Oct 31, 2022
@antho1404 antho1404 deleted the feature/reduce-bundle-size branch October 31, 2022 03:35
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