webpack-runtime js files getting a 404

帅比萌擦擦* 提交于 2021-02-10 08:45:32

问题


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?


回答1:


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

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. 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

This will:

  1. Prevent your website from creating service-workers on new visitors.
  2. Remove service-workers and effectively removing the caching capability from returning visitors.


来源:https://stackoverflow.com/questions/56710367/webpack-runtime-js-files-getting-a-404

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!