siblings not specified correctly in chunk(stats json) #19765
Replies: 2 comments 1 reply
-
Thanks for the feedback. After analyzing the issue, Maybe this is the expected behavior, Only chunks within the same ChunkGroup are considered siblings. ┌─────────────────────────────────────────────────────────────┐
│ Webpack Chunk Relationship │
└─────────────────────────────────────────────────────────────┘
┌─────────────────┐ ┌─────────────────┐
│ ChunkGroup A │ │ ChunkGroup B │
│ (Async Chunk) │ │ (Async Chunk) │
├─────────────────┤ ├─────────────────┤
│ │ │ │
│ ┌─────────┐ │ │ ┌─────────┐ │
│ │ foo │ │ │ │ bar │ │
│ │ (async) │ │ │ │ (async) │ │
│ └─────────┘ │ │ └─────────┘ │
│ │ │ │ │ │
│ │ │ │ │ │
│ ┌─────────┐ │ │ ┌─────────┐ │
│ │commonAsync│ │ │ │commonAsync│ │
│ │ _haha │ │ │ │ _haha │ │
│ │(common) │ │ │ │(common) │ │
│ └─────────┘ │ │ └─────────┘ │
└─────────────────┘ └─────────────────┘
│ │
└───────────────────────┘
│
┌─────────────┐
│ shared.js │
│(shared mod) │
└─────────────┘ |
Beta Was this translation helpful? Give feedback.
-
What do you mean by "ChunkGroup"? Is there a clearer definition? From your drawing above, it appears that "ChunkGroup" refers to the Chunk before the "cacheGroups" logic takes effect, i.e., the initial/async chunk emitted by Webpack originally. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Here is the setting for webpack
Here is the js file
We can see above that 'foo' and 'bar' should be async chunks, And there are some common parts in 'foo' and 'bar' which will be separated as another chunk named commonAsync_haha due to the cacheGroups config.
However in the stats json
The siblings of foo/bar are ["commonAsync_haha"], while the siblings of commonAsync_haha is ["bar", "foo"].
Here is the webpack "version": "5.100.2",
Beta Was this translation helpful? Give feedback.
All reactions