getChunkModuleIdMap(chunk, filterFn, includeAllChunks = false) {
		/** @type {Record<string|number, (string|number)[]>} */
		const chunkModuleIdMap = Object.create(null);

		for (const asyncChunk of includeAllChunks
			? chunk.getAllReferencedChunks()
			: chunk.getAllAsyncChunks()) {
			/** @type {(string | number)[] | undefined} */
			let array;
			for (const module of this.getOrderedChunkModulesIterable(
				asyncChunk,
				compareModulesById(this)
			)) {
				if (filterFn(module)) {
					if (array === undefined) {
						array = [];
						chunkModuleIdMap[/** @type {ChunkId} */ (asyncChunk.id)] = array;
					}
					const moduleId = /** @type {ModuleId} */ (this.getModuleId(module));
					array.push(moduleId);
				}
			}
		}

		return chunkModuleIdMap;
	}
@param {Chunk} chunk the chunk
@param {ModuleFilterPredicate} filterFn function used to filter modules
@param {boolean} includeAllChunks all chunks or only async chunks
@returns {Record<string|number, (string|number)[]>} chunk to module ids object