MCPcopy
hub / github.com/webpack/webpack / checkIgnore

Method checkIgnore

lib/IgnorePlugin.js:36–60  ·  view source on GitHub ↗

* Note that if "contextRegExp" is given, both the "resourceRegExp" and "contextRegExp" have to match. * @param {ResolveData | BeforeContextResolveData} resolveData resolve data * @returns {false | undefined} returns false when the request should be ignored, otherwise undefined

(resolveData)

Source from the content-addressed store, hash-verified

34 * @returns {false | undefined} returns false when the request should be ignored, otherwise undefined
35 */
36 checkIgnore(resolveData) {
37 if (
38 "checkResource" in this.options &&
39 this.options.checkResource &&
40 this.options.checkResource(resolveData.request, resolveData.context)
41 ) {
42 return false;
43 }
44
45 if (
46 "resourceRegExp" in this.options &&
47 this.options.resourceRegExp &&
48 this.options.resourceRegExp.test(resolveData.request)
49 ) {
50 if ("contextRegExp" in this.options && this.options.contextRegExp) {
51 // if "contextRegExp" is given,
52 // both the "resourceRegExp" and "contextRegExp" have to match.
53 if (this.options.contextRegExp.test(resolveData.context)) {
54 return false;
55 }
56 } else {
57 return false;
58 }
59 }
60 }
61
62 /**
63 * Applies the plugin by registering its hooks on the compiler.

Callers 1

applyMethod · 0.95

Calls 1

testMethod · 0.45

Tested by

no test coverage detected