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