Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

bundlesize check #183

Closed
wants to merge 16 commits into from
Closed

bundlesize check #183

wants to merge 16 commits into from

Conversation

webb04
Copy link
Contributor

@webb04 webb04 commented Feb 11, 2020

Fail the builds if the client side javascript bundles become too large.

Copy link

@alexduf alexduf left a comment

Choose a reason for hiding this comment

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

I suspect you've pushed the dist/* files by mistakes? Should that be added to the gitignore?

If they are added voluntarily, why?

@webb04
Copy link
Contributor Author

webb04 commented Feb 12, 2020

I suspect you've pushed the dist/* files by mistakes? Should that be added to the gitignore?

If they are added voluntarily, why?

They were added to check the bundle size in GitHub actions, but we should be able to generate the dist files in the CI. I'll give that another go

@JamieB-gu
Copy link
Contributor

JamieB-gu commented Feb 12, 2020

I like this idea, but do we need to rely on a library to do it?

const fs = require('fs');

const sizeLimit = 100000;
const bundle = './dist/assets/article.js';

if (fs.statSync(bundle).size > sizeLimit) {
    process.exit(1);
} else {
    process.exit(0);
}

@webb04
Copy link
Contributor Author

webb04 commented Feb 12, 2020

I like this idea, but do we need to rely on a library to do it?

const fs = require('fs');

const sizeLimit = 100000;
const bundle = './dist/assets/article.js';

if (fs.statSync(bundle).size > sizeLimit) {
    process.exit(1);
} else {
    process.exit(0);
}

That's interesting... I think it does some extra things like gzipping, although we could do this ourselves too. The library had a nice reporter feature to GitHub but I was getting 500s when trying to use it.

@webb04
Copy link
Contributor Author

webb04 commented Feb 12, 2020

So after doing this it looks like danger.js might be better.... facebook/react#14717

But that's probably worth another pr

@webb04 webb04 closed this Feb 14, 2020
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.

3 participants