MCPcopy
hub / github.com/webpack/webpack / removeChunkFromDependencies

Method removeChunkFromDependencies

lib/Compilation.js:4635–4666  ·  view source on GitHub ↗

* Removes chunk from dependencies. * @param {DependenciesBlock} block block tie for Chunk * @param {Chunk} chunk chunk to remove from dep * @returns {void}

(block, chunk)

Source from the content-addressed store, hash-verified

4633 * @returns {void}
4634 */
4635 removeChunkFromDependencies(block, chunk) {
4636 /**
4637 * Iterator dependency.
4638 * @param {Dependency} d dependency to (maybe) patch up
4639 */
4640 const iteratorDependency = (d) => {
4641 const depModule = this.moduleGraph.getModule(d);
4642 if (!depModule) {
4643 return;
4644 }
4645 this.patchChunksAfterReasonRemoval(depModule, chunk);
4646 };
4647
4648 const blocks = block.blocks;
4649 for (const asyncBlock of blocks) {
4650 const chunkGroup =
4651 /** @type {ChunkGroup} */
4652 (this.chunkGraph.getBlockChunkGroup(asyncBlock));
4653 // Grab all chunks from the first Block's AsyncDepBlock
4654 const chunks = chunkGroup.chunks;
4655 // For each chunk in chunkGroup
4656 for (const iteratedChunk of chunks) {
4657 chunkGroup.removeChunk(iteratedChunk);
4658 // Recurse
4659 this.removeChunkFromDependencies(block, iteratedChunk);
4660 }
4661 }
4662
4663 if (block.dependencies) {
4664 for (const dep of block.dependencies) iteratorDependency(dep);
4665 }
4666 }
4667
4668 assignRuntimeIds() {
4669 const { chunkGraph } = this;

Callers 1

Calls 2

getBlockChunkGroupMethod · 0.80
removeChunkMethod · 0.45

Tested by

no test coverage detected