Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Lighthouse 上测试了我的 angular pwa 并得到了以下信息:
我已经更改了我的 ngsw-config.json 以尝试为assetGroups 添加cacheConfig,但它似乎只对dataGroups 有效?
我还尝试编辑我的 htaccess 文件并添加以下行:
标头集 Cache-Control: "max-age=31536000, public"
到目前为止,这些都对我不起作用。
assetGroups 没有 max-age,但您可以像这样为 dataGroups 设置 max-age:
"dataGroups": [ { "name": "API Call", "urls": ["https://website.com"], "cacheConfig": { "maxAge": "30m", "strategy": "performance", "maxSize": 10 } } ]
在与assetGroups 相同的级别上定义它