ContextExclusionPlugin.js 384 B

1234567891011121314151617
  1. "use strict";
  2. class ContextExclusionPlugin {
  3. constructor(negativeMatcher) {
  4. this.negativeMatcher = negativeMatcher;
  5. }
  6. apply(compiler) {
  7. compiler.plugin("context-module-factory", (cmf) => {
  8. cmf.plugin("context-module-files", (files) => {
  9. return files.filter(filePath => !this.negativeMatcher.test(filePath));
  10. });
  11. });
  12. }
  13. }
  14. module.exports = ContextExclusionPlugin;