fix: preserve filenameTemplate in new split chunk

This commit is contained in:
Henry Dineen 2024-12-28 23:54:17 -05:00
parent 4ab682db5f
commit e401c64833
No known key found for this signature in database
2 changed files with 6 additions and 3 deletions

View File

@ -1743,6 +1743,9 @@ module.exports = class SplitChunksPlugin {
);
chunk.split(newPart);
newPart.chunkReason = chunk.chunkReason;
if (chunk.filenameTemplate) {
newPart.filenameTemplate = chunk.filenameTemplate;
}
// Add all modules to the new chunk
for (const module of group.items) {
if (!module.chunkCondition(newPart, compilation)) {

View File

@ -4062,10 +4062,10 @@ production (webpack x.x.x) compiled successfully"
`;
exports[`StatsTestCases should print correct stats for split-chunks-cache-group-filename 1`] = `
"Entrypoint main X KiB = 587.js X bytes 414.js X bytes 605.vendors.js X bytes main.js X KiB
chunk (runtime: main) 414.js (id hint: vendors) X bytes [initial] [rendered] split chunk (cache group: vendors)
"Entrypoint main X KiB = 587.vendors.js X bytes 414.vendors.js X bytes 605.vendors.js X bytes main.js X KiB
chunk (runtime: main) 414.vendors.js (id hint: vendors) X bytes [initial] [rendered] split chunk (cache group: vendors)
./node_modules/b.js X bytes [built] [code generated]
chunk (runtime: main) 587.js (id hint: vendors) X bytes [initial] [rendered] split chunk (cache group: vendors)
chunk (runtime: main) 587.vendors.js (id hint: vendors) X bytes [initial] [rendered] split chunk (cache group: vendors)
./node_modules/a.js X bytes [built] [code generated]
chunk (runtime: main) 605.vendors.js (id hint: vendors) X bytes [initial] [rendered] split chunk (cache group: vendors)
./node_modules/c.js X bytes [built] [code generated]