MCPcopy
hub / github.com/webpack/webpack / _buildAssetToChunkIndex

Method _buildAssetToChunkIndex

lib/Compilation.js:5366–5386  ·  lib/Compilation.js::Compilation._buildAssetToChunkIndex

* @private * @returns {void}

()

Source from the content-addressed store, hash-verified

5364 * @returns {void}
5365 */
5366 _buildAssetToChunkIndex() {
5367 if (this._assetToChunkIndex !== undefined) return;
5368 /** @type {Map<string, Set<Chunk>>} */
5369 const filesIndex = new Map();
5370 /** @type {Map<string, Set<Chunk>>} */
5371 const auxiliaryIndex = new Map();
5372 for (const chunk of this.chunks) {
5373 for (const file of chunk.files) {
5374 let set = filesIndex.get(file);
5375 if (set === undefined) filesIndex.set(file, (set = new Set()));
5376 set.add(chunk);
5377 }
5378 for (const file of chunk.auxiliaryFiles) {
5379 let set = auxiliaryIndex.get(file);
5380 if (set === undefined) auxiliaryIndex.set(file, (set = new Set()));
5381 set.add(chunk);
5382 }
5383 }
5384 this._assetToChunkIndex = filesIndex;
5385 this._assetToChunkAuxiliaryIndex = auxiliaryIndex;
5386 }
5387
5388 /**
5389 * @private

Callers 2

renameAssetMethod · 0.95
deleteAssetMethod · 0.95

Calls 3

getMethod · 0.45
setMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected