[DO NOT MERGE] Provide a standalone way to run rollup for stats gathering #3115
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Just a late idea for running a more recent version of rollup for gathering stats, waiting for us to move to rollup 3, taking a different route than #3109:
Instead of running during our build, it bundles a one off entry, dynamically generated, that imports the content of our package.
rollup-plugin-visualizer
still serves as a stat collection tool and we'd need to look in the JSON stats it creates to highlight what we want.I'm imagining multiple entries pointing to each of the
govuk-esm
files to ensure that when imported they only load the modules we expect them to. Especially when importing parts of the exports (eg.Accordion
fromall.mjs
), we could check that treeshaking works as intended.This could be:
rollup-plugin-visualizer
before we set it up on our build. Allowing us to put all the effort on it rather than a bit with size-limit now, and digging deeper once we've moved to rollup 3.rollup
's way of tree-shaking)How it works
It uses an npm workspace to let us install a newer version of Rollup for our shenanigans. That means you'll need to run it with:
It then configures rollup with:
Futher developmentQuick tryIdea would be to generate a list of
[filePath, importName?]
entries based on a listing of the following format, filing results in files properly namespaced ([componentOrFileName]-[import].json
for example: