How to fix the console warning “The resource … was preloaded using link preload but not used within a few seconds from the window's load event”?

99封情书 提交于 2021-01-21 10:40:08

问题


I'm developing a gatsby theme/starter for PWA's, but I can't seem to get rid of the following console warning:

The resource https://davidde.github.io/gatsby-starter-simpwa/page-data/offline-plugin-app-shell-fallback/page-data.json
was preloaded using link preload but not used within a few seconds from the window's load event.
Please make sure it has an appropriate `as` value and it is preloaded intentionally.

On first load everything works fine; the service worker registers like it should and there is no warning. However, after reloading, this warning shows up. This makes no sense since the as value is set to 'fetch'. I'm assuming it has something to do with the configuration of gatsby-plugin-offline or maybe gatsby-plugin-manifest.

The source code is at https://github.com/davidde/gatsby-starter-simpwa,
and it's deployed to https://davidde.github.io/gatsby-starter-simpwa/.

Does anyone have any idea what is causing this?


回答1:


Try to use the prefetch in the place of preload



来源:https://stackoverflow.com/questions/59638198/how-to-fix-the-console-warning-the-resource-was-preloaded-using-link-preloa

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