Gatsby插件离线不缓存文件

问题描述

我正在与gatsby PWA合作。这是使用灯箱审核时的错误列表。

enter image description here

问题是我的服务人员无法正常工作或无法缓存页面,并且我确定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}"],

解决方法

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

可能有很多原因,例如:

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

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

顺便说一句:即使您的gatsby-config看起来不错,我还是建议您先使用默认设置。因此,请删除“ workboxConfig-Stuff ...”,然后为清单部分选择{{ 1}}代表standalone

祝你好运。