function createNamedChunkGroupFactory(stats, publicPath) {
  const chunksById = new Map(stats.chunks?.map(chunk => [chunk.id, chunk]));
  return group => {
    /** @type {Set<string>} */
    const files = new Set();
    stats.namedChunkGroups?.[group].chunks?.forEach(chunkId => {
      const chunk = chunksById.get(chunkId);
      chunk?.files?.forEach(file => files.add(createUrl(publicPath, file)));
    });
    return [...files];
  };
}
@param {import("webpack").StatsCompilation} stats
@param {string} publicPath
@returns {(group: string) => string[]}