Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Integrate bundle-analyzer #115

Merged
merged 6 commits into from
Apr 15, 2020
Merged

Integrate bundle-analyzer #115

merged 6 commits into from
Apr 15, 2020

Conversation

koss-lebedev
Copy link

@koss-lebedev koss-lebedev commented Apr 1, 2020

This PR integrates with https://www.bundle-analyzer.com/ to check that file sizes are within the specified limit. I put 200kb as a max size for JS bundle, and 100kb for CSS. We can adjust them later, but for now they look like a good starting point.

},
{
test: '*.css',
maxSize: '100 kB',

Choose a reason for hiding this comment

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

@koss-lebedev Nothing but just out of curiosity - How did we come up with these maxSize values? Is it a standard? Thanks

Copy link
Author

Choose a reason for hiding this comment

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

@HonzaBartos Well, the default setting for Bundle Analyzer is to cap all files at 250kb. I checked that the output from Gatsby for JS was under 200kb, so I thought it'd be nice to keep it that way 🙂The value for CSS size is random, just from experience, I think it should never grow over 100kb

Copy link
Contributor

Choose a reason for hiding this comment

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

Afaik a standard for JavaScript is 170kB :)

I would leave there a note/todo, that this supposed to be ideally set in hand with performance budget. Even though this one kinda behaves as a perf budget, but it's not exactly it :)

Copy link

@arnostpleskot arnostpleskot left a comment

Choose a reason for hiding this comment

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

Looks solid to me 💪.
The only thing that I would add is .env.example file to keep track of required env vars.

Copy link
Contributor

@dannytce dannytce left a comment

Choose a reason for hiding this comment

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

Nice job! Looks straightforward. Kudos for readme! :)

I found a few nitpicks, otherwise LGTM.

README.md Show resolved Hide resolved
},
{
test: '*.css',
maxSize: '100 kB',
Copy link
Contributor

Choose a reason for hiding this comment

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

Afaik a standard for JavaScript is 170kB :)

I would leave there a note/todo, that this supposed to be ideally set in hand with performance budget. Even though this one kinda behaves as a perf budget, but it's not exactly it :)

README.md Outdated Show resolved Hide resolved
@dannytce
Copy link
Contributor

dannytce commented Apr 1, 2020

@koss-lebedev could you also pretty please change the base of PR into v3? 🙏

Copy link
Contributor

@dannytce dannytce left a comment

Choose a reason for hiding this comment

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

Ok, one more thing just popped in my mind. Could you please write down an ADR for that? I would put it into separate folder docs/adr

ADR helps to track other possible solutions. There is, for example, https://github.com/siddharthkp/bundlesize or https://github.com/webpack-contrib/webpack-bundle-analyzer

So it would be cool to know, why this bundle-analyzer was chosen :)

Thank you!

@koss-lebedev
Copy link
Author

@dannytce Good question 🙂To be honest, I didn't consider other options because bundle-analyzer was referenced directly in the issue, but if you don't mind, I would like to take a look at other options

@dannytce
Copy link
Contributor

dannytce commented Apr 1, 2020

@koss-lebedev yeah originally I wasn't planning to do that. But even with pretty straightforward Lighthouse #114 I realized there are numerous implementations of the same thing. So I thought it might be worth to try them and document them :)

@koss-lebedev koss-lebedev force-pushed the feat/bundle-analyzer branch from 482f871 to b61b092 Compare April 3, 2020 11:58
@koss-lebedev koss-lebedev requested a review from dannytce April 3, 2020 12:12
@koss-lebedev koss-lebedev force-pushed the feat/bundle-analyzer branch from b61b092 to 80426a8 Compare April 3, 2020 12:13
Copy link
Contributor

@dannytce dannytce left a comment

Choose a reason for hiding this comment

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

@koss-lebedev: Great job, love it! 💪

Two nitpicks

  1. 170kB was related to the JavaScript bundle, not CSS one 😅 Anyway don't worry about it, we can change whenever we want :)
  2. Could you also pretty please change the base of PR into v3? 🙏

@koss-lebedev koss-lebedev changed the base branch from master to v3 April 7, 2020 08:36
@dannytce dannytce merged commit bcff1aa into v3 Apr 15, 2020
@dannytce dannytce deleted the feat/bundle-analyzer branch April 15, 2020 10:22
@dannytce dannytce mentioned this pull request Apr 15, 2020
17 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants