【问题标题】:Lighthouse & Polymer: start_url in manifest is not cached by Service WorkerLighthouse & Polymer:清单中的 start_url 未被 Service Worker 缓存
【发布时间】:2017-10-24 17:21:09
【问题描述】:

我正在测试我的 Polymer 应用程序,我在 Lighthouse 上获得了不错的分数。但是,我还有一个小问题。我有一个 manifest.json 文件,其中包含所有内容,因此可以将应用程序添加到主屏幕,但 Lighthouse 仍然失败说:Manifest start_url is not cached by a Service Worker.。我正在使用 Polymer Starter Kit 2.0,但我不知道如何使用 Service Worker 缓存它。我有一个 sw-precache-config.js 包含:

module.exports = {
  staticFileGlobs: [
    '/index.html',
    '/index.html?launcher=true',
    '/manifest.json',
    '/bower_components/webcomponentsjs/*',
  ],
  navigateFallback: '/index.html',
};

/index.html?launcher=true 是清单的 start_url。

【问题讨论】:

  • 你在使用http/2推送吗?在我(仅)实施推送资源后,我从 Lighthouse 收到了同样的错误。
  • 不,我没有使用 http 推送

标签: caching polymer polymer-starter-kit polymer-2.x lighthouse


【解决方案1】:

我认为在你的“index.html”文件中你有:

rel="manifest" href="manifest.json"
您必须通过以下方式更改它:
rel="manifest" href="/manifest.json"

您可以在此处找到 Google 团队提供的代码实验室: https://codelabs.developers.google.com/codelabs/add-to-home-screen/#3

【讨论】:

    猜你喜欢
    • 2018-01-01
    • 2018-03-28
    • 2017-06-22
    • 2016-09-14
    • 2017-05-28
    • 2018-03-04
    • 1970-01-01
    • 2018-06-17
    • 1970-01-01
    相关资源
    最近更新 更多