MCPcopy
hub / github.com/webpack/webpack / normalizeChunksFilter

Function normalizeChunksFilter

lib/optimize/SplitChunksPlugin.js:469–485  ·  view source on GitHub ↗
(chunks)

Source from the content-addressed store, hash-verified

467 * @returns {ChunkFilterFn | undefined} the chunk filter function
468 */
469const normalizeChunksFilter = (chunks) => {
470 if (chunks === "initial") {
471 return INITIAL_CHUNK_FILTER;
472 }
473 if (chunks === "async") {
474 return ASYNC_CHUNK_FILTER;
475 }
476 if (chunks === "all") {
477 return ALL_CHUNK_FILTER;
478 }
479 if (chunks instanceof RegExp) {
480 return (chunk) => (chunk.name ? chunks.test(chunk.name) : false);
481 }
482 if (typeof chunks === "function") {
483 return chunks;
484 }
485};
486
487/**
488 * Normalizes cache groups.

Callers 2

createCacheGroupSourceFunction · 0.85
constructorMethod · 0.85

Calls 1

testMethod · 0.45

Tested by

no test coverage detected