MCPcopy
hub / github.com/webpack/webpack / getChunkSize

Method getChunkSize

lib/ChunkGraph.js:997–1010  ·  view source on GitHub ↗

* Returns total size of the chunk. * @param {Chunk} chunk the chunk * @param {ChunkSizeOptions} options options object * @returns {number} total size of the chunk

(chunk, options = {})

Source from the content-addressed store, hash-verified

995 * @returns {number} total size of the chunk
996 */
997 getChunkSize(chunk, options = {}) {
998 const cgc = this._getChunkGraphChunk(chunk);
999 const modulesSize = cgc.modules.getFromUnorderedCache(getModulesSize);
1000 const chunkOverhead =
1001 typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000;
1002 const entryChunkMultiplicator =
1003 typeof options.entryChunkMultiplicator === "number"
1004 ? options.entryChunkMultiplicator
1005 : 10;
1006 return (
1007 chunkOverhead +
1008 modulesSize * (chunk.canBeInitial() ? entryChunkMultiplicator : 1)
1009 );
1010 }
1011
1012 /**
1013 * Gets integrated chunks size.

Callers 4

sizeMethod · 0.80
applyMethod · 0.80
applyMethod · 0.80
applyMethod · 0.80

Calls 3

_getChunkGraphChunkMethod · 0.95
getFromUnorderedCacheMethod · 0.80
canBeInitialMethod · 0.80

Tested by

no test coverage detected