Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gather breakdown of modules content #3281

Closed
5 tasks done
Tracked by #3279 ...
romaricpascal opened this issue Feb 13, 2023 · 0 comments · Fixed by #3681
Closed
5 tasks done
Tracked by #3279 ...

Gather breakdown of modules content #3281

romaricpascal opened this issue Feb 13, 2023 · 0 comments · Fixed by #3681

Comments

@romaricpascal
Copy link
Member

romaricpascal commented Feb 13, 2023

What

Collect which modules get added to built bundles when importing our modules1. This can be:

  • importing individual components directly (import Accordion from 'govuk-frontend/components/accordion.mjs')
  • importing individual components from all.mjs (import {Accordion} from 'govuk-frontend')
  • importing all exports (import * as GOVUKFrontend from 'govuk-frontend')

Display this breakdown inside the review app so it can be accessible for each pull-request.

Note: The performance spike used the approach of building from a virtual file with a specific import for each scenario. We may be able to collect the same stats more efficiently at build time, so it'll be worth giving a quick comparison at both options.

Why

This will let us check which sub-modules are part of each of our main modules, and spot when our changes make a component inadvertently bring in a sub-module they don't need.

This also lets us check that our modules tree-shake as expecting, bringing only the code they need in the final bundle.

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

  • We collect breakdown of modules
  • We serve this breakdown from the review app 2:
    • as a text breakdown for accessibility
    • as an interactive visualisation
  • We list all modules being monitored in an index page so we can navigate to them

Footnotes

  1. Using a similar approach to the performance spike, with rollup-plugin-visualizer

  2. rollup-plugin-visualizer provides 3 kinds of visualisation, but we only really need the treemap or sunburst. Neither are particularly accessible, though (information is only available on hover), hence the text alternative we need to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

3 participants