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

后端 未结 23 1058
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-30 02:08

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 a         


        
23条回答
  •  再見小時候
    2020-11-30 02:54

    I had a similar error but not exactly the same described by other answers. I hope my answer can help someone.

    I was importing a file in two components (angular 7 project):

    Component 1:

    LANGUAGES = require("../../models/LANGUAGES.json");
    

    Component 2:

    LANGUAGES = require("../../models/LANGUAGES.JSON");
    

    This is a foolish mistake: the problem here is I'm using two differents requires on the same file with different capital letters (it generated a warning).

    How to solve the problem ? Use the same model.

    Component 1:

    LANGUAGES = require("../../models/LANGUAGES.json");
    

    Component 2:

    LANGUAGES = require("../../models/LANGUAGES.json");
    

    OR

    Component 1:

    LANGUAGES = require("../../models/LANGUAGES.JSON");
    

    Component 2:

    LANGUAGES = require("../../models/LANGUAGES.JSON");
    

提交回复
热议问题