7. Use BundleWatch to automate bundle size checking#

7.1. Status#

Accepted

7.2. Context#

It is important for users of the Open edX platform that we deliver reasonably sized JavaScript bundles. This provides faster load times to all users, and is vital for users with low bandwidth and/or metered connections.

It is currently possible to manually monitor bundle size information by utilizing webpack configurations provided by frontend-build, but this functionality is not very discoverable. Given the “hidden” nature of this functionality, it is very possible for changes that increase bundle size to be missed in the PR review process.

The increased visibility provided by automated bundle size monitoring will ensure we don’t unintentionally increase the size of our JavaScript bundles, as well as encourage maintainers to adopt best practices such as code splitting.

7.3. Decision#

BundleWatch will be adopted by the Open edX community for automatic JavaScript bundle size monitoring. Repository maintainers will decide if this CI check will be blocking or informative on a repo-by-repo basis.

7.3.1. BundleWatch#

BundleWatch is solely focused on ensuring bundle sizes stay under control. It is actively maintained and used by popular projects such as bootstrap.

7.4. Consequence#

Implementing BundleWatch will require very few changes to our existing CI workflows. The BundleWatch GitHub app will be added to the Open edX GitHub organization, and bundle size checking will be added to the CI process for JavaScript based repositories.

7.5. Rejected Alternatives#

  1. Code Checks

    Code Checks is a pluggable framework for automated code review. It provides more than just bundle size monitoring, presenting us with an opportunity to rethink our current CI workflows. For example, Code Checks provides test coverage monitoring, which would allow us to re-evaluate the choice to use CodeCov as documented in Use Codecov to measure code covered by tests.

    While this additional functionality is potentially desirable, moving forward with a single purpose tool (BundleWatch) provides us the functionality we need with minimal changes to our current CI workflows.

  2. Bundlesize

    Bundlesize is no longer actively maintained.