* This method first looks to see if a name is provided for a new chunk, * and first looks to see if any named chunks already exist and reuse that chunk instead. * @param {ChunkName=} name optional chunk name to be provided * @returns {Chunk} create a chunk (invoked during seal event)
(name)
| 4468 | * @returns {Chunk} create a chunk (invoked during seal event) |
| 4469 | */ |
| 4470 | addChunk(name) { |
| 4471 | if (name) { |
| 4472 | const chunk = this.namedChunks.get(name); |
| 4473 | if (chunk !== undefined) { |
| 4474 | return chunk; |
| 4475 | } |
| 4476 | } |
| 4477 | const chunk = new Chunk(name, this._backCompat); |
| 4478 | this.chunks.add(chunk); |
| 4479 | if (this._backCompat) { |
| 4480 | ChunkGraph.setChunkGraphForChunk(chunk, this.chunkGraph); |
| 4481 | } |
| 4482 | if (name) { |
| 4483 | this.namedChunks.set(name, chunk); |
| 4484 | } |
| 4485 | return chunk; |
| 4486 | } |
| 4487 | |
| 4488 | /** |
| 4489 | * Processes the provided module. |
no test coverage detected