Webpack:“有多个模块的名称只是大小写不同";但引用的模块是相同的 [英] Webpack: "there are multiple modules with names that only differ in casing" but modules referenced are identical

查看:21
本文介绍了Webpack:“有多个模块的名称只是大小写不同";但引用的模块是相同的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 webpack 3.8.1 并收到以下构建警告的几个实例:

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?

推荐答案

这通常是一个微小的拼写错误造成的.

This is usually a result of a minuscule typo.

例如,如果您要导入像 import Vue from 'vue' 这样的模块,import Vuex from 'vuex'.

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

浏览您的文件并检查您使用 from 'Vue'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.

错误描述应该写的更清楚,但是我每次解释的都是webpack命令出现这个错误的原因.

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.

这篇关于Webpack:“有多个模块的名称只是大小写不同";但引用的模块是相同的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆