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

Integrate bundle-analyzer - #115

Merged
dannytce merged 6 commits into
v3from
feat/bundle-analyzer
Apr 15, 2020
Merged

Integrate bundle-analyzer#115
dannytce merged 6 commits into
v3from
feat/bundle-analyzer

Conversation

@koss-lebedev

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

Copy link
Copy Markdown

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.

Comment thread bundle-analyzer.config.js Outdated
},
{
test: '*.css',
maxSize: '100 kB',

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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 :)

@arnostpleskot arnostpleskot left a comment

Copy link
Copy Markdown

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.

@dannytce dannytce left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread README.md
Comment thread bundle-analyzer.config.js Outdated
},
{
test: '*.css',
maxSize: '100 kB',

Copy link
Copy Markdown
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 :)

Comment thread README.md Outdated
@dannytce

dannytce commented Apr 1, 2020

Copy link
Copy Markdown
Contributor

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

@dannytce dannytce left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

dannytce commented Apr 1, 2020

Copy link
Copy Markdown
Contributor

@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

@dannytce dannytce left a comment

Copy link
Copy Markdown
Contributor

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