✏️ 编辑:ContextExclusionPlugin.js
路径:
/home/boguraj1/public_html/jobsite/node_modules/webpack/lib/ContextExclusionPlugin.js
大小:797 B · 修改:2022-11-21 20:12:36 · 权限:0644 · 可写
← 返回目录
👁 查看
⬇ 下载
/* MIT License http://www.opensource.org/licenses/mit-license.php */ "use strict"; /** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./ContextModuleFactory")} ContextModuleFactory */ class ContextExclusionPlugin { /** * @param {RegExp} negativeMatcher Matcher regular expression */ constructor(negativeMatcher) { this.negativeMatcher = negativeMatcher; } /** * Apply the plugin * @param {Compiler} compiler the compiler instance * @returns {void} */ apply(compiler) { compiler.hooks.contextModuleFactory.tap("ContextExclusionPlugin", cmf => { cmf.hooks.contextModuleFiles.tap("ContextExclusionPlugin", files => { return files.filter(filePath => !this.negativeMatcher.test(filePath)); }); }); } } module.exports = ContextExclusionPlugin;
💾 保存
取消
保存为 UTF-8,换行统一为 LF