* Helper to sort chunks * * @private * @param {string[]} entryNames * @param {string|((entryNameA: string, entryNameB: string) => number)} sortMode * @param {Compilation} compilation
(entryNames, sortMode, compilation)
| 380 | * @param {Compilation} compilation |
| 381 | */ |
| 382 | sortEntryChunks(entryNames, sortMode, compilation) { |
| 383 | // Custom function |
| 384 | if (typeof sortMode === "function") { |
| 385 | return entryNames.sort(sortMode); |
| 386 | } |
| 387 | // Check if the given sort mode is a valid chunkSorter sort mode |
| 388 | if (typeof chunkSorter[sortMode] !== "undefined") { |
| 389 | return chunkSorter[sortMode](entryNames, compilation, this.options); |
| 390 | } |
| 391 | throw new Error('"' + sortMode + '" is not a valid chunk sort mode'); |
| 392 | } |
| 393 | |
| 394 | /** |
| 395 | * Encode each path component using `encodeURIComponent` as files can contain characters |