Webpack: "there are multiple modules with names that only differ in casing" but modules referenced are identical

tcelferact picture tcelferact · Nov 28, 2017 · Viewed 72.1k times · Source

I'm using webpack 3.8.1 and am receiving several instances of the following build warning:

WARNING in ./src/Components/NavBar/MainMenuItemMobile.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* /Users/path/to/babel-loader/lib/index.js!/Users/path/to/NavBar/MainMenuItemMobile.js
    Used by 1 module(s), i. e.
    /Users/path/to/babel-loader/lib/index.js!/Users/path/to/NavBar/ConstructedMainMenuItems.js
* /Users/path/to/babel-loader/lib/index.js!/Users/path/to/Navbar/MainMenuItemMobile.js
    Used by 1 module(s), i. e.
    /Users/path/to/babel-loader/lib/index.js!/Users/path/to/Navbar/ConstructedMainMenuItems.js
.....
(webpack)-hot-middleware/client.js ./src/index.js

What's confusing is that the 'two' files referenced are just one file—there are no two files in the directory whose names differ only in case.

I've also noticed that my hot reloader often doesn't pick up changes to a file if it is affected by these warnings.

What could be causing this issue?

Answer

matthiku picture matthiku · Dec 4, 2017

This is usually a result of a minuscule typo.

For instance, if you are importing your modules like import Vue from 'vue', import Vuex from 'vuex'.

Go through your files and check where you used from 'Vue' or from 'Vuex' - make sure to use the exact same capitals (uppercase letters) as in your import statements.

The error descriptions should have been written more clearly, but what I explained has been the cause of my problem each time for this error on webpack commands.