fix: detect module graph change right before build_chunk_graph #9453
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.
Summary
Background
We have a way to skip re-building chunk graph, that is, when module graph has no change, no incoming outgoing changes, we can skip creating chunks for current compilation.
We detect module graph change in make phase before, which is not exactly accurate.
Issue
Many optimizations are applied after make phase, for example,
innerGraph
,sideEffects
andusedExports
, they can change module graph as well. To solve this, we did a lot of hack to detect change according to many aspects, evendependency.ids
, as it can affect howsideEffects
optimized.Current solution
Now I move this detection later right before
build_chunk_graph
, and compare current outgoings with last compilation, in this stage, all optimizations are already applied.Long term solution
When incremental for
build_chunk_graph
is stable, we no longer need to detect the changes and skip creating chunks, as incremental build chunks is performant enoughChecklist