【问题标题】:React error: warn There are multiple modules with names that only differ in casing反应错误:警告有多个模块的名称只是大小写不同
【发布时间】:2020-02-27 13:39:29
【问题描述】:

我收到有关“多个模块的名称只是大小写不同”的警告。

我尝试了什么:更改 react 的导入声明,删除节点模块并使用 npm i 重新安装。

这就是我在组件中导入 react 的方式:import React from 'react'

这是警告信息:

This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* /Users/Downloads/website/node_modules/gatsby/dist/utils/babel-loader.js??ref--4-0!/Users/Downloads/website/node_modules/eslint-loader/index.js??ref--11-0!/Users/Downloads/website/src/components/DiscoverBannerIndex.js
    Used by 6 module(s), i. e.
    /Users/Downloads/website/node_modules/gatsby/dist/utils/babel-loader.js??ref--4-0!/Users/Downloads/website/node_modules/eslint-loader/index.js??ref--11-0!/Users/Downloads/website/src/pages/download/windows.js
* /Users/Downloads/website/node_modules/gatsby/dist/utils/babel-loader.js??ref--4-0!/Users/Downloads/website```

【问题讨论】:

    标签: reactjs gatsby


    【解决方案1】:

    这个错误通常意味着你做了这样的事情:

    // in one file:
    import Foo from "src/components/Foo"
    
    // in another file:
    import Foo from "src/components/foo"
    

    【讨论】:

      【解决方案2】:

      如果对他人有帮助:

      在 Windows 中,我创建了 Index.ts(错误),然后创建了 index.ts,但由于某种原因,在删除 Index.ts 后我仍然遇到了这个问题。删除 index.ts 并从头开始做 index.ts 解决了它

      【讨论】:

        猜你喜欢
        • 2018-01-08
        • 2021-05-14
        • 2020-04-16
        • 1970-01-01
        • 2019-09-03
        • 2018-12-16
        • 2021-09-17
        • 2018-05-12
        • 1970-01-01
        相关资源
        最近更新 更多