[core] Prevent unstable chunks in size snapshot #23181
Merged
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.
stable chunks
Previously we ran
webpack
once with each package being an entry. This means that webpack creates chunks that are shared by different packages. For example,@material-ui/core
and@material-ui/lab
could share some part of@material-ui/styles
. This results in the reported size of@material-ui/core
being affected by changes in
@material-ui/lab
.We're now running separate webpack compiler instances for each package to prevent shared chunks. We didn't do this previously because of perf considerations. However, perf shouldn't affect results. Caching the terser results improves perf while not changing results. Runs with cache hits are as fast as previously versions of this scripts but cache misses result in considerably slower runs in CI (local should be fine unless you have a single core machine) but are still faster then the full pipeline (argos completes). The slowness isn't as big of a problem for the initial run anymore since the time until the comment is reserved stays the same.
The reported sizes should be a lot more stable and accurate. We should get this in before #21761 since the reported size in that PR is weird.
size:snapshot --analyze
For easier debugging of the bundle size you can now run
yarn size:snapshot --analyze
which creates static reports for each bundle that can be inspected. We're not using the server since that would open >100 ports.