我正在将服务人员添加到现有的Angular Web应用中。
在ngsw-config.json
中,我包括了:
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name": "assets",
"installMode": "prefetch",
"resources": {
"files": [
"/assets/**"
]
}
}
字体文件在assets/fonts/*
中可用,因此它应该包含在表达式/assets/**
在我的应用程序中切换到离线模式时。每个资产均按预期方式从缓存加载。但是我在控制台中仅对我的字体有此错误:
The FetchEvent for "http://localhost:8001/assets/fonts/pluto-regular.otf" resulted in a network error response: the promise was rejected.
GET http://localhost:8001/assets/fonts/pluto-regular.otf net::ERR_FAILED
我手动检查了缓存,就在这里...
如何进一步调试?发生了什么事?