【问题标题】:Parcel Serve returns 404 due to adding hash to index.html由于向 index.html 添加哈希,Parcel Serve 返回 404
【发布时间】:2022-12-24 07:59:42
【问题描述】:

第一次开始使用包裹。我在我的项目中设置了包裹并运行了parcel serve src/index.html。

构建成功,但是当我转到 url 时,出现 404 错误:

当我检查 dist 文件夹时,我在那里找到了我的文件,但索引文件本身有一个哈希值,因此调用 http://localhost:1234/index.html 返回 404

但是调用 http://localhost:1234/index.html.4183.0 是可行的

我如何告诉 parcel 在没有额外哈希的情况下正确构建 index.html?我试过 no-content-hash 无济于事。

【问题讨论】:

    标签: parcel


    【解决方案1】:

    我在运行 parcel 开发服务器时遇到了类似的 404 问题,并注意到在我的情况下它只在我重新启动我的机器后才发生。

    经过一些调查,我发现我观察到的 404 问题与 .parcel-cache 文件夹有关。当我清除它时,问题没有发生。在咨询文档后 - https://parceljs.org/features/cli/ - 我找到了 --no-cache 选项,它有助于完全解决问题。

    【讨论】:

      猜你喜欢
      • 2021-06-18
      • 2020-12-11
      • 2023-03-03
      • 2023-04-03
      • 2012-01-07
      • 2021-05-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多