webpack-runtime js文件获取404 [英] webpack-runtime js files getting a 404

查看:35
本文介绍了webpack-runtime js文件获取404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于Gatsby/Netlify的站点,该站点最近才开始出现间歇性问题,其中一些js资产返回了404.该问题似乎是独立出现的.这是devtools控制台的屏幕截图:

I've got a site built on Gatsby/Netlify that just recently started having an intermittent issue where some of the js assets return a 404. The issue seems to appear and go away on its own. Here's a screenshot of the devtools console:

我应该检查什么类型的东西?

What kinds of things should I check?

推荐答案

可能是您已经安装了 gatsby-plugin-offline 并且正在缓存旧文件.

Chances are you have gatsby-plugin-offline installed and it is caching old files.

盖茨比社区仍在寻找方法,以100%解决此问题,但是,如果PWA对您的用例而言并非十分重要,则有一个其他网站一直在使用的临时解决方案:

The Gatsby community is still looking for ways to 100% solve this issue, but there is a temporary solution that other websites have been using if being a PWA is not incredibly important to your use-case:

  1. gatsby-config.js 中删除 gatsby-plugin-offline .
  2. gatsby-plugin-remove-serviceworker 添加到 gatsby-config.js .
  3. $纱线添加gatsby-plugin-remove-serviceworker
  1. Remove gatsby-plugin-offline from gatsby-config.js.
  2. Add gatsby-plugin-remove-serviceworker to gatsby-config.js.
  3. $ yarn add gatsby-plugin-remove-serviceworker

这将:

  1. 防止您的网站吸引新访问者来创建服务工作者.
  2. 删除服务人员,并有效地从返回的访问者中删除缓存功能.

这篇关于webpack-runtime js文件获取404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆