【问题标题】:When build the app: GET http://localhost ......json 404 (Not Found)构建应用程序时:GET http://localhost ......json 404 (Not Found)
【发布时间】:2019-10-21 19:24:02
【问题描述】:

我有我的应用程序反应 (create-app-react...) 我的应用程序访问文件夹 assets 中的文件 .json。在我的本地测试中没有问题,但是当在 IIS 中发布时(npm run build)无法访问此文件 .json,在控制台中获取此错误:GET http://localhost:3700/assets/locales/en/isotope.json404(未找到)。

我的结构应用程序... 资产 语言环境 es 同位素.json 静止的 css js 索引.html ...

你能帮帮我吗?

【问题讨论】:

  • 您能分享一下您在代码中设置的路径吗?并确保在 IIS 中正确托管 ReactJS。

标签: reactjs iis


【解决方案1】:

问题在于 MIME 类型 (IIS) 中未包含 .json。 现在开始工作!!!

谢谢

【讨论】:

    【解决方案2】:

    您必须手动复制未通过requireimport 添加的资源。确保您在服务器的站点根目录中有 assets 文件夹。

    【讨论】:

      猜你喜欢
      • 2021-11-20
      • 2021-12-17
      • 2019-01-13
      • 2018-10-27
      • 1970-01-01
      • 2021-12-12
      • 2017-01-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多