* Adds the provided async entrypoint to this chunk group. * @param {EntryOptions} options options for the entrypoint * @param {Module} module the module the references the chunk group * @param {DependencyLocation} loc the location from with the chunk group is referenced (inside of module) *
(options, module, loc, request)
| 4426 | * @returns {Entrypoint} the new or existing entrypoint |
| 4427 | */ |
| 4428 | addAsyncEntrypoint(options, module, loc, request) { |
| 4429 | const name = options.name; |
| 4430 | if (name) { |
| 4431 | const entrypoint = this.namedChunkGroups.get(name); |
| 4432 | if (entrypoint instanceof Entrypoint) { |
| 4433 | if (module) { |
| 4434 | entrypoint.addOrigin(module, loc, request); |
| 4435 | } |
| 4436 | return entrypoint; |
| 4437 | } else if (entrypoint) { |
| 4438 | throw new Error( |
| 4439 | `Cannot add an async entrypoint with the name '${name}', because there is already an chunk group with this name` |
| 4440 | ); |
| 4441 | } |
| 4442 | } |
| 4443 | const chunk = this.addChunk(name); |
| 4444 | if (options.filename) { |
| 4445 | chunk.filenameTemplate = options.filename; |
| 4446 | } |
| 4447 | const entrypoint = new Entrypoint(options, false); |
| 4448 | entrypoint.setRuntimeChunk(chunk); |
| 4449 | entrypoint.setEntrypointChunk(chunk); |
| 4450 | if (name) { |
| 4451 | this.namedChunkGroups.set(name, entrypoint); |
| 4452 | } |
| 4453 | this.chunkGroups.push(entrypoint); |
| 4454 | this.asyncEntrypoints.push(entrypoint); |
| 4455 | if (entrypoint.pushChunk(chunk)) { |
| 4456 | chunk.addGroup(entrypoint); |
| 4457 | } |
| 4458 | if (module) { |
| 4459 | entrypoint.addOrigin(module, loc, request); |
| 4460 | } |
| 4461 | return entrypoint; |
| 4462 | } |
| 4463 | |
| 4464 | /** |
| 4465 | * This method first looks to see if a name is provided for a new chunk, |
nothing calls this directly
no test coverage detected