Already included file name

来源:4-8 Dropdown 组件基本功能编码

Zedof

2020-10-01

张老师您好,我修改了一下组件名称的大小写,然后再import里修改了对应的大小写,Vetur就报错。我查了一下,这好像是 typescript的老bug了,有什么办法能解决吗?
e.g.

HiMan.vue =>Himan.vue // 名称
-----------------------------
import Himan from './components/Himan.vue'

adamcfranco commented on 6 Jul 2018
Error TS1149: File name ‘C:/Project/frontend/scripts/State.ts’ differs from already included file name ‘…/frontend/scripts/State.ts’ only in casing.

I’ve triple checked the casing in our references and the actual files
have the correct casing as well. As far as I can tell, this is solely
because the relative path uses incorrect casing, or perhaps it’s just
because of the relative path itself?

It compiles just fine on Mac and Linux, but throws this error on
Windows.

写回答

2回答

张轩

2020-10-01

同学你好 这个应该是 vscode 的一个 bug 把,在网上找到相关的解决方法:https://stackoverflow.com/questions/51197940/file-name-differs-from-already-included-file-name-only-in-casing-on-relative-p  你可以试试看。

有一个回答是在 tsconfig 中设置一项

{  
  "compilerOptions": {
    ...    
    "forceConsistentCasingInFileNames": false,
    ...
  }
}


4
0

Zedof

提问者

2020-10-01

最后我修改了项目名,这个vetur的报错bug才消失,我倒,这也太雷人了吧!

0
0

Vue3 + TS 仿知乎专栏企业级项目

带你完成前后端分离复杂项目,率先掌握 vue3 造轮子技能

3142 学习 · 2313 问题

查看课程