* Gets integrated chunks size. * @param {Chunk} chunkA chunk * @param {Chunk} chunkB chunk * @param {ChunkSizeOptions} options options object * @returns {number} total size of the chunk or false if chunks can't be integrated
(chunkA, chunkB, options = {})
| 1017 | * @returns {number} total size of the chunk or false if chunks can't be integrated |
| 1018 | */ |
| 1019 | getIntegratedChunksSize(chunkA, chunkB, options = {}) { |
| 1020 | const cgcA = this._getChunkGraphChunk(chunkA); |
| 1021 | const cgcB = this._getChunkGraphChunk(chunkB); |
| 1022 | const allModules = new Set(cgcA.modules); |
| 1023 | for (const m of cgcB.modules) allModules.add(m); |
| 1024 | const modulesSize = getModulesSize(allModules); |
| 1025 | const chunkOverhead = |
| 1026 | typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000; |
| 1027 | const entryChunkMultiplicator = |
| 1028 | typeof options.entryChunkMultiplicator === "number" |
| 1029 | ? options.entryChunkMultiplicator |
| 1030 | : 10; |
| 1031 | return ( |
| 1032 | chunkOverhead + |
| 1033 | modulesSize * |
| 1034 | (chunkA.canBeInitial() || chunkB.canBeInitial() |
| 1035 | ? entryChunkMultiplicator |
| 1036 | : 1) |
| 1037 | ); |
| 1038 | } |
| 1039 | |
| 1040 | /** |
| 1041 | * Checks whether it can chunks be integrated. |
no test coverage detected