Angular PWA部署Firebase Hosting时无法加载Manifest图标
Ionic Angular PWA部署Firebase后Manifest图标加载错误问题
我按照Ionic官方指南将Angular应用改造为PWA并部署至Firebase Hosting,指南要求设置公共目录为"www",操作后生成了www文件夹。为避免index.html出现404错误,我修改了firebase.json配置,内容如下:
{ "firestore": { "rules": "firestore.rules", "indexes": "firestore.indexes.json" }, "hosting": { "public": "www/browser", "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], "headers": [ { "source": "/build/app/**", "headers": [ { "key": "Cache-Control", "value": "public, max-age=31536000" } ] }, { "source": "ngsw-worker.js", "headers": [ { "key": "Cache-Control", "value": "no-cache" } ] } ], "rewrites": [ { "source": "**", "destination": "/index.html" } ] } }
以下是browser文件夹中的manifest文件内容:
{ "name": "pongPong", "short_name": "pongPong", "theme_color": "#1976d2", "background_color": "#fafafa", "display": "standalone", "scope": "./", "start_url": "./", "icons": [ { "src": "icons/icon-72x72.png", "sizes": "72x72", "type": "image/png", "purpose": "maskable any" }, { "src": "icons/icon-96x96.png", "sizes": "96x96", "type": "image/png", "purpose": "maskable any" }, { "src": "icons/icon-128x128.png", "sizes": "128x128", "type": "image/png", "purpose": "maskable any" }, { "src": "icons/icon-152x152.png", "sizes": "152x152", "type": "image/png", "purpose": "maskable any" }, { "src": "icons/icon-192x192.png", "sizes": "192x192", "type": "image/png", "purpose": "maskable any" }, { "src": "icons/icon-384x384.png", "sizes": "384x384", "type": "image/png", "purpose": "maskable any" }, { "src": "icons/icon-512x512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable any" } ] }
无论修改何种路径,始终收到以下错误:
尝试使用Manifest中的图标时出错:https://bestpractices-7894a.web.app/icons/icon-152x152.png(下载错误或资源不是有效图片)
内容的提问来源于stack exchange,提问作者NickTriesReallyHard
相关产品推荐
相关产品推荐

