Skip to content

Commit 1c0a062

Browse files
committed
added contextRegExp to IgnorePlugin
1 parent e957ec7 commit 1c0a062

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎lib/IgnorePlugin.js‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
function IgnorePlugin(resourceRegExp) {
5+
function IgnorePlugin(resourceRegExp, contextRegExp) {
66
this.resourceRegExp = resourceRegExp;
7+
this.contextRegExp = contextRegExp;
78
}
89
module.exports = IgnorePlugin;
910
IgnorePlugin.prototype.apply = function(compiler) {
1011
var resourceRegExp = this.resourceRegExp;
12+
var contextRegExp = this.contextRegExp;
1113
compiler.plugin("normal-module-factory", function(nmf) {
1214
nmf.plugin("before-resolve", function(result, callback) {
1315
if(!result) return callback();
14-
if(resourceRegExp.test(result.request)) {
16+
if(resourceRegExp.test(result.request) &&
17+
(!contextRegExp || contextRegExp.test(result.context))) {
1518
return callback();
1619
}
1720
return callback(null, result);

0 commit comments

Comments
 (0)