webpack/lib/ContextExclusionPlugin.js

18 lines
408 B
JavaScript
Raw Normal View History

"use strict";
class ContextExclusionPlugin {
constructor(negativeMatcher) {
this.negativeMatcher = negativeMatcher;
}
apply(compiler) {
2017-12-06 22:01:25 +08:00
compiler.hooks.contextModuleFactory.tap("ContextExclusionPlugin", (cmf) => {
cmf.plugin("context-module-files", (files) => {
return files.filter(filePath => !this.negativeMatcher.test(filePath));
});
});
}
}
module.exports = ContextExclusionPlugin;