source: trip-planner-front/node_modules/webpack/lib/WarnCaseSensitiveModulesPlugin.js@ 1ad8e64

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

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const CaseSensitiveModulesWarning = require("./CaseSensitiveModulesWarning");
9
10/** @typedef {import("./Compiler")} Compiler */
11/** @typedef {import("./Module")} Module */
12
13class WarnCaseSensitiveModulesPlugin {
14 /**
15 * Apply the plugin
16 * @param {Compiler} compiler the compiler instance
17 * @returns {void}
18 */
19 apply(compiler) {
20 compiler.hooks.compilation.tap(
21 "WarnCaseSensitiveModulesPlugin",
22 compilation => {
23 compilation.hooks.seal.tap("WarnCaseSensitiveModulesPlugin", () => {
24 /** @type {Map<string, Map<string, Module>>} */
25 const moduleWithoutCase = new Map();
26 for (const module of compilation.modules) {
27 const identifier = module.identifier();
28 const lowerIdentifier = identifier.toLowerCase();
29 let map = moduleWithoutCase.get(lowerIdentifier);
30 if (map === undefined) {
31 map = new Map();
32 moduleWithoutCase.set(lowerIdentifier, map);
33 }
34 map.set(identifier, module);
35 }
36 for (const pair of moduleWithoutCase) {
37 const map = pair[1];
38 if (map.size > 1) {
39 compilation.warnings.push(
40 new CaseSensitiveModulesWarning(
41 map.values(),
42 compilation.moduleGraph
43 )
44 );
45 }
46 }
47 });
48 }
49 );
50 }
51}
52
53module.exports = WarnCaseSensitiveModulesPlugin;
Note: See TracBrowser for help on using the repository browser.