ContextExclusionPlugin.js 401B

123456789101112131415161718
  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;