next.js& PWA:灯塔在清单中找不到图标。

发布于 2025-02-08 11:49:18 字数 1186 浏览 4 评论 0原文

我正在尝试将现有的NextJS应用程序转换为PWA。 当我在http:// localhost上运行灯塔报告时:3000 yarn build&&纱线开始我看到了这两个错误:

  1. 失败:清单没有至少512px的PNG图标。
  2. 清单没有可掩盖的图标

,但是我的清单确实包含一个大小的单个图像文件

  • :1024x1024
  • 类型:任何掩模

这是我的清单文件:

{
  "name": "my-app",
  "short_name": "my-app",
  "theme_color": "#eee57c",
  "background_color": "#eee57c",
  "display": "fullscreen",
  "orientation": "portrait",
  "scope": "/",
  "start_url": "/",
  "icons": [
    [
      {
        "src": "./icons/1024.png",
        "sizes": "1024x1024",
        "type": "image/png",
        "purpose": "any maskable"
      }
    ]
  ],
  "splash_pages": null
}

下面也是我的public的屏幕截图/public> public/icon下显示1024.png的文件夹。

我还尝试更改路径ICONS/1024.png /icons/1024.png 和当前./ icons/ 1024.png,但没有一个使错误消失。

为什么Lighthouse报告没有大小&GT的PNG; 512px还是可掩盖的图像?

I'm trying to convert an existing NextJS app to a PWA.
When I run lighthouse report on http://localhost:3000 after yarn build && yarn start I see these 2 errors:

  1. Failures: Manifest does not have a PNG icon of at least 512px.
  2. Manifest doesn't have a maskable icon

However my manifest does contain a single image file that is

  • size: 1024x1024
  • type: any maskable

This is my manifest file:

{
  "name": "my-app",
  "short_name": "my-app",
  "theme_color": "#eee57c",
  "background_color": "#eee57c",
  "display": "fullscreen",
  "orientation": "portrait",
  "scope": "/",
  "start_url": "/",
  "icons": [
    [
      {
        "src": "./icons/1024.png",
        "sizes": "1024x1024",
        "type": "image/png",
        "purpose": "any maskable"
      }
    ]
  ],
  "splash_pages": null
}

Below is also a screenshot of my public/ folder showing there is indeed an 1024.png under public/icon.

enter image description here

I have also tried changing the path icons/1024.png /icons/1024.png and the current ./icons/1024.png but none of them make the errors go away.

Why is Lighthouse reporting that there is no PNG with size > 512px or a maskable image?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文