webpack/lib/ContextExclusionPlugin.js

18 lines
432 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) => {
2017-12-14 04:35:39 +08:00
cmf.hooks.contextModuleFiles.tap("ContextExclusionPlugin", (files) => {
return files.filter(filePath => !this.negativeMatcher.test(filePath));
});
});
}
}
module.exports = ContextExclusionPlugin;