fixes #8538
This commit is contained in:
parent
7a6a71f1e9
commit
bc368c7611
|
@ -38,6 +38,8 @@ class IgnorePlugin {
|
||||||
* @returns {TODO|null} returns result or null if result should be ignored
|
* @returns {TODO|null} returns result or null if result should be ignored
|
||||||
*/
|
*/
|
||||||
checkIgnore(result) {
|
checkIgnore(result) {
|
||||||
|
if (!result) return result;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
"checkResource" in this.options &&
|
"checkResource" in this.options &&
|
||||||
this.options.checkResource &&
|
this.options.checkResource &&
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = "ignored";
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = "ignored";
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = "normal";
|
|
@ -0,0 +1,18 @@
|
||||||
|
/* globals it */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
it("should ignore ignored resources 1", function() {
|
||||||
|
expect(function() {
|
||||||
|
require("./ignored-module1");
|
||||||
|
}).toThrowError();
|
||||||
|
});
|
||||||
|
it("should ignore ignored resources 2", function() {
|
||||||
|
expect(function() {
|
||||||
|
require("./ignored-module2");
|
||||||
|
}).toThrowError();
|
||||||
|
});
|
||||||
|
it("should not ignore resources that do not match", function() {
|
||||||
|
expect(function() {
|
||||||
|
require("./normal-module");
|
||||||
|
}).not.toThrowError();
|
||||||
|
});
|
|
@ -0,0 +1,18 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const IgnorePlugin = require("../../../../lib/IgnorePlugin");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: "./test.js",
|
||||||
|
externals: {
|
||||||
|
"./normal-module": "{}"
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new IgnorePlugin({
|
||||||
|
resourceRegExp: /ignored-module1/
|
||||||
|
}),
|
||||||
|
new IgnorePlugin({
|
||||||
|
resourceRegExp: /ignored-module2/
|
||||||
|
})
|
||||||
|
]
|
||||||
|
};
|
Loading…
Reference in New Issue