meteor-feature-requests icon indicating copy to clipboard operation
meteor-feature-requests copied to clipboard

Bundle size check package

Open jamesmillerburgess opened this issue 5 years ago • 1 comments

This is a feature proposal for a new non-core Meteor package to check bundle sizes, and there is already a head-start on it from a file we have in our primary Meteor project: https://gist.github.com/jamesmillerburgess/a16a0c3b789ceba50cbf30a905f49e30

We run it with an npm script in CircleCI to check that the modern and legacy browser bundles don't go over a certain gzipped size. We've been using it now for about a year.

I've always thought that with a few tweaks, this would make for a convenient Meteor package. And since we are now migrating our project away from Meteor, I wanted to share this code before it gets deleted forever!

jamesmillerburgess avatar Apr 14 '20 11:04 jamesmillerburgess

And here is a gist for the jest test file we have: https://gist.github.com/jamesmillerburgess/4dd6372346677785d60de2a0bdf51983

We enforce 100% code coverage on unit tests, which is why there are quite a few tests inside.

This is paired with a very simple mock of WebAppInternals, since jest can't read Meteor packages:

export const WebAppInternals = {};

jamesmillerburgess avatar Apr 17 '20 08:04 jamesmillerburgess