Repository: webpack/webpack
File: lib/dependencies/WorkerPlugin.js (JavaScript)

Code before:
										)
									);
								} else {
									entryOptions.name = importOptions.webpackChunkName;
								}
							}
						}

						if (
							!Object.prototype.hasOwnProperty.call(entryOptions, "name") &&
							options &&
							typeof options.name === "string"
						) {
							entryOptions.name = options.name;
						}

						if (!modBlockMap.has(parser.state.module)) {
							modBlockMap.set(parser.state.module, {});
						}
						// For the same URL, we try to reuse the same AsyncDependenciesBlock
						const key = `name(${entryOptions.name}), url(${url})`;
						const cache =
							/** @type {Record<string, AsyncDependenciesBlock>} */ (
								modBlockMap.get(parser.state.module)
							);
						if (!cache[key]) {
							if (entryOptions.runtime === undefined) {
								const i = workerIndexMap.get(parser.state) || 0;
								workerIndexMap.set(parser.state, i + 1);
								const name = `${cachedContextify(
									parser.state.module.identifier()
								)}|${i}`;
								const hash = createHash(compilation.outputOptions.hashFunction);
								hash.update(name);
								const digest = hash.digest(
									compilation.outputOptions.hashDigest
								);
								entryOptions.runtime = digest.slice(
									0,
									compilation.outputOptions.hashDigestLength
								);
							}
							const block = new AsyncDependenciesBlock({
								name: entryOptions.name,
								entryOptions: {
									chunkLoading: this._chunkLoading,
									wasmLoading: this._wasmLoading,
									...entryOptions
								}
							});
							block.loc = expr.loc;

Review comment (suggestion):
Just idea - what it we will add the `circular` property with `true` value for such case(s) and when ignore chunk creation in buildGraph, so we will not have circular dependency warning

Code after:
								}
							}
						}

						if (
							!Object.prototype.hasOwnProperty.call(entryOptions, "name") &&
							options &&
							typeof options.name === "string"
						) {
							entryOptions.name = options.name;
						}

						if (entryOptions.runtime === undefined) {
							const i = workerIndexMap.get(parser.state) || 0;
							workerIndexMap.set(parser.state, i + 1);
							const name = `${cachedContextify(
								parser.state.module.identifier()
							)}|${i}`;
							const hash = createHash(compilation.outputOptions.hashFunction);
							hash.update(name);
							const digest = hash.digest(compilation.outputOptions.hashDigest);
							entryOptions.runtime = digest.slice(
								0,
								compilation.outputOptions.hashDigestLength
							);
						}

						const block = new AsyncDependenciesBlock({
							name: entryOptions.name,
							key: url,
							entryOptions: {
								chunkLoading: this._chunkLoading,
								wasmLoading: this._wasmLoading,
								...entryOptions
							}
						});
						block.loc = expr.loc;
						const dep = new WorkerDependency(url, range, {
							publicPath: this._workerPublicPath,
							needNewUrl
						});
						dep.loc = /** @type {DependencyLocation} */ (expr.loc);
						block.addDependency(dep);
						parser.state.module.addBlock(block);

						if (compilation.outputOptions.trustedTypes) {
							const dep = new CreateScriptUrlDependency(
								/** @type {Range} */ (expr.arguments[0].range)
							);
							dep.loc = /** @type {DependencyLocation} */ (expr.loc);
							parser.state.module.addDependency(dep);