webpack/lib/ContextExclusionPlugin.js

18 lines
428 B
JavaScript
Raw Normal View History

"use strict";
class ContextExclusionPlugin {
constructor(negativeMatcher) {
this.negativeMatcher = negativeMatcher;
}
apply(compiler) {
2018-02-25 09:00:20 +08:00
compiler.hooks.contextModuleFactory.tap("ContextExclusionPlugin", cmf => {
cmf.hooks.contextModuleFiles.tap("ContextExclusionPlugin", files => {
return files.filter(filePath => !this.negativeMatcher.test(filePath));
});
});
}
}
module.exports = ContextExclusionPlugin;