GeezerVison is showing github.com — fix issue when contextRegExp is undefined · webpack/webpack@6c22ca2
File tree
Expand file treeCollapse file tree
Open diff view settings
test/configCases/errors/multi-entry-missing-module
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/IgnorePlugin.js +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,10 +40,11 @@ class IgnorePlugin { |
40 | 40 | checkIgnore(result) { |
41 | 41 | if ( |
42 | 42 | "checkResource" in this.options && |
| 43 | + this.options.checkResource && |
43 | 44 | this.options.checkResource(result.request, result.context) |
44 | 45 | ) { |
45 | 46 | // TODO webpack 5 remove checkContext, as checkResource already gets context |
46 | | - if ("checkContext" in this.options) { |
| 47 | + if ("checkContext" in this.options && this.options.checkContext) { |
47 | 48 | if (this.options.checkContext(result.context)) { |
48 | 49 | return null; |
49 | 50 | } |
@@ -54,9 +55,10 @@ class IgnorePlugin { |
54 | 55 |
|
55 | 56 | if ( |
56 | 57 | "resourceRegExp" in this.options && |
| 58 | + this.options.resourceRegExp && |
57 | 59 | this.options.resourceRegExp.test(result.request) |
58 | 60 | ) { |
59 | | - if ("contextRegExp" in this.options) { |
| 61 | + if ("contextRegExp" in this.options && this.options.contextRegExp) { |
60 | 62 | // if "contextRegExp" is given, |
61 | 63 | // both the "resourceRegExp" and "contextRegExp" have to match. |
62 | 64 | if (this.options.contextRegExp.test(result.context)) { |
|
Collapse file
Copy file name to clipboardExpand all lines: test/configCases/errors/multi-entry-missing-module/webpack.config.js +1-3Lines changed: 1 addition & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,9 +8,7 @@ module.exports = { |
8 | 8 | filename: "[name].js" |
9 | 9 | }, |
10 | 10 | plugins: [ |
11 | | - new IgnorePlugin({ |
12 | | - resourceRegExp: new RegExp(/intentionally-missing-module/) |
13 | | - }) |
| 11 | + new IgnorePlugin(/intentionally-missing-module/) |
14 | 12 | ], |
15 | 13 | node: { |
16 | 14 | __dirname: false |
|