盖茨比:图像加载然后在 netlify 上消失。使用 gatsby develop 在我的电脑上运行良好,在 Zeit 上运行良好

Gatsby : image load then disapear on netlify. Works fine on my computer with gatsby develop and works fine on Zeit

我做了一个基本的博客来测试 Gatsby 和 Netlify CMS。

我有一个很奇怪的问题。

当页面完全加载时,博客的标志消失。 这只发生在 Netlify 上。 用“Gatsby Develop”命令,没有问题。

我测试用Zeit托管博客,图片没有消失。

网络化:https://wonderful-dubinsky-d2e0f3.netlify.com/ 时间:https://recettes-ecru.now.sh/

两个网站使用相同的 Github 存储库。

最后发现是service worker的问题。 我正在使用 gatsby-plugin-offline。此插件使用 Service Worker 使 Gatsby 站点离线工作。

默认情况下,浏览器会将 Service Worker 缓存 24 小时,并且在您重新加载页面时不会更新它们。

取消注册我的 service worker 后,问题就解决了。

此处有用的阅读资料: https://community.netlify.com/t/common-issue-understanding-unregistering-service-workers/145

如何卸载服务工作者: https://love2dev.com/blog/how-to-uninstall-a-service-worker/