source: trip-planner-front/node_modules/webpack/lib/ContextExclusionPlugin.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 797 bytes
RevLine 
[6a3a178]1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3*/
4
5"use strict";
6
7/** @typedef {import("./Compiler")} Compiler */
8/** @typedef {import("./ContextModuleFactory")} ContextModuleFactory */
9
10class ContextExclusionPlugin {
11 /**
12 * @param {RegExp} negativeMatcher Matcher regular expression
13 */
14 constructor(negativeMatcher) {
15 this.negativeMatcher = negativeMatcher;
16 }
17
18 /**
19 * Apply the plugin
20 * @param {Compiler} compiler the compiler instance
21 * @returns {void}
22 */
23 apply(compiler) {
24 compiler.hooks.contextModuleFactory.tap("ContextExclusionPlugin", cmf => {
25 cmf.hooks.contextModuleFiles.tap("ContextExclusionPlugin", files => {
26 return files.filter(filePath => !this.negativeMatcher.test(filePath));
27 });
28 });
29 }
30}
31
32module.exports = ContextExclusionPlugin;
Note: See TracBrowser for help on using the repository browser.