There are multiple modules with names that only differ in casing. 問題的一種解決方法


------------恢復內容開始------------

 WARNING  Compiled with 2 warnings

 warning  in ./node_modules/node-libs-browser/mock/process.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:
* C:\Users\coder\Source\Repos\project_name\views\node_modules\node-libs-browser\mock\process.js
    Used by 1 module(s), i. e.
    C:\Users\coder\Source\Repos\project_name\views\node_modules\axios\lib\defaults.js
* C:\Users\coder\source\repos\project_name\views\node_modules\node-libs-browser\mock\process.js
    Used by 1 module(s), i. e.
    C:\Users\coder\source\repos\project_name\views\node_modules\path-browserify\index.js

 warning  in ./node_modules/webpack/buildin/global.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:
* C:\Users\coder\Source\Repos\project_name\views\node_modules\webpack\buildin\global.js
    Used by 3 module(s), i. e.
    C:\Users\coder\Source\Repos\project_name\views\node_modules\vue\dist\vue.runtime.esm.js
* C:\Users\coder\source\repos\project_name\views\node_modules\webpack\buildin\global.js
    Used by 2 module(s), i. e.
    C:\Users\coder\source\repos\project_name\views\node_modules\sockjs-client\dist\sockjs.js

  

網上可以查到好多帖子,有說把 import 的 @ 和 ‘../../xxx’ 這兩種路徑描述方式統一的,還有說查找一下文件名大小寫的。

不過這個問題應該都是在windows系統下做開發會出現,主要是路徑的大小寫問題,有的人帖子寫的是自定義組件文件名的問題(不過這種情況下,大小寫對不上應該會直接在控制台報錯的),象我這樣屬於npm里的三方組件庫。

后來我想了一下,我的代碼換過一次位置,換到了 C:\Users\coder\Source\Repos  這個存在大寫字母的路徑下,於是我就想是否可能原因在這里。

所以我就在 C:\code\project_name 這個目錄(除盤符全小寫)下重新從git拖了一個項目過來,再運行,真就不報warning了。。。

大家全在小寫路徑下存代碼應該就可以了,另外組件和文件名也建議全小寫,省去各種因字母大小寫產生的困擾,駝峰不了就用減號或下划線分隔。

------------恢復內容結束------------

快寫完還沒發的時候電腦死機了。。博客園的這個即時保存和恢復功能真是太香了!!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM