【问题标题】:Gatsby plugin offline not caching the filesGatsby 插件离线不缓存文件
【发布时间】:2020-09-30 11:24:09
【问题描述】:

我正在使用 gatsby PWA。以下是使用灯箱审核时的错误列表。

问题是我的服务人员没有工作或没有缓存页面,我确信我在gatsby.config.js 中的配置有问题。请帮忙

  {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: `gatsby-starter-default`,
        short_name: `starter`,
        start_url: `/`,
        background_color: `#663399`,
        theme_color: `#663399`,
        display: `minimal-ui`,
        icon: `icon.png`, // This path is relative to the root of the site.
      },
    },
    {
      resolve: `gatsby-plugin-offline`,
      options: {
        workboxConfig: {
          globPatterns: ["**/*.{js,jpg,png,html,css}"],
        },
      },
    },

【问题讨论】:

    标签: reactjs gatsby progressive-web-apps gatsby-plugin


    【解决方案1】:

    在您的 LightHouse 报告中,单击上方的“PWA”图标(圆圈)。 这会将您向下滚动到它的给定部分。 在那里您发现了一些通知,为什么无法为此页面建立 PWA。

    这可能有很多原因:

    • 页面无法通过 HTTPS://访问
    • 没有规范标签
    • 未找到清单图标
    • 清单有问题/错误

    因此,也许可以分享 url,以便其他人可以查看它以帮助您,或者发布一些有关 PWA-Section 的屏幕截图(或一些带有详细问题的请求)。

    顺便说一句:即使您的 gatsby-config 看起来不错,我还是建议您先使用默认值。所以删除“workboxConfig-Stuff...”并为您的清单部分选择 @987654321 @ 代表display

    祝你好运。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-26
      • 1970-01-01
      • 2023-01-19
      • 1970-01-01
      • 2021-12-16
      • 1970-01-01
      • 2011-11-19
      • 1970-01-01
      相关资源
      最近更新 更多