MCPcopy
hub / github.com/webpack/webpack / groupChunksByExports

Method groupChunksByExports

lib/optimize/SplitChunksPlugin.js:971–985  ·  view source on GitHub ↗
(module)

Source from the content-addressed store, hash-verified

969 * @returns {Iterable<Chunk[]>} groups of chunks with equal exports
970 */
971 const groupChunksByExports = (module) => {
972 const exportsInfo = moduleGraph.getExportsInfo(module);
973 /** @type {Map<string, Chunk[]>} */
974 const groupedByUsedExports = new Map();
975 for (const chunk of chunkGraph.getModuleChunksIterable(module)) {
976 const key = exportsInfo.getUsageKey(chunk.runtime);
977 const list = groupedByUsedExports.get(key);
978 if (list !== undefined) {
979 list.push(chunk);
980 } else {
981 groupedByUsedExports.set(key, [chunk]);
982 }
983 }
984 return groupedByUsedExports.values();
985 };
986
987 /** @type {Map<Module, Iterable<Chunk[]>>} */
988 const groupedByExportsMap = new Map();

Callers

nothing calls this directly

Calls 7

getExportsInfoMethod · 0.80
getUsageKeyMethod · 0.80
getMethod · 0.45
pushMethod · 0.45
setMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected