项目警告: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 modul

记录个自己遇到的问题:

上星期项目刚拉取下来的时候运行没有任何警告,晚上回去vscode提示更新新的东西,当时没管就立即更新了,第二天重启项目直接一大堆警告冒了出来:

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 modul

看不懂,有道翻译了一下:“有多个模块的名称只在大小写上有所不同。在使用其他大小写语义编译文件系统时,这会导致意外的行为。用平等的套管。比较这些模块”

百度查了下原因,意思是有同一个文件,我们在多次 import 引入时文件名写法不一样了(大小写),比如下面

import Index from './index.vue'

import Index from './Index.vue'

这样引入就会引起Eslint插件的代码格式检查错误

但是我检查了下自己写的那部分代码,并没有引入文件的时候错误啊,一脸懵逼,一直百度并找同事帮忙,搞了好半天也没弄好,今天把业务功能写完了,同事说搞一下这些警告问题,

先是把之前引入的文件名首字母改为大写,不行。。

没办法了,卸载webpack,删除node_modules文件夹,重新安装最新版的webpack,然后重新安装依赖包,运行一下,警告居然消失了(无语,也不知道是哪里导致的)

原文地址:https://www.cnblogs.com/secretAngel/p/10045376.html