2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
8 const CaseSensitiveModulesWarning = require("./CaseSensitiveModulesWarning");
10 /** @typedef {import("./Compiler")} Compiler */
11 /** @typedef {import("./Module")} Module */
13 class WarnCaseSensitiveModulesPlugin {
16 * @param {Compiler} compiler the compiler instance
20 compiler.hooks.compilation.tap(
21 "WarnCaseSensitiveModulesPlugin",
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) {
32 moduleWithoutCase.set(lowerIdentifier, map);
34 map.set(identifier, module);
36 for (const pair of moduleWithoutCase) {
39 compilation.warnings.push(
40 new CaseSensitiveModulesWarning(
42 compilation.moduleGraph
53 module.exports = WarnCaseSensitiveModulesPlugin;