MCPcopy
hub / github.com/webpack/webpack / checkModuleType

Function checkModuleType

lib/optimize/SplitChunksPlugin.js:601–615  ·  view source on GitHub ↗
(test, module)

Source from the content-addressed store, hash-verified

599 * @returns {boolean} true, if the module should be selected
600 */
601const checkModuleType = (test, module) => {
602 if (test === undefined) return true;
603 if (typeof test === "function") {
604 return test(module.type);
605 }
606 if (typeof test === "string") {
607 const type = module.type;
608 return test === type;
609 }
610 if (test instanceof RegExp) {
611 const type = module.type;
612 return test.test(type);
613 }
614 return false;
615};
616
617/** @typedef {(layer: string | null) => boolean} CheckModuleLayerFn */
618

Callers 1

normalizeCacheGroupsFunction · 0.85

Calls 2

testFunction · 0.50
testMethod · 0.45

Tested by

no test coverage detected