webpack-runtime js文件获取404 [英] webpack-runtime js files getting a 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:
- 从
gatsby-config.js
中删除gatsby-plugin-offline
. - 将
gatsby-plugin-remove-serviceworker
添加到gatsby-config.js
. -
$纱线添加gatsby-plugin-remove-serviceworker
- Remove
gatsby-plugin-offline
fromgatsby-config.js
. - Add
gatsby-plugin-remove-serviceworker
togatsby-config.js
. $ yarn add gatsby-plugin-remove-serviceworker
这将:
- 防止您的网站吸引新访问者来创建服务工作者.
- 删除服务人员,并有效地从返回的访问者中删除缓存功能.
这篇关于webpack-runtime js文件获取404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!