1 回答

TA贡献1776条经验 获得超12个赞
通过删除 $schema 像这样更新您的服务工作者,我的配置与您的相同
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
]
}
}
]
}
您遇到了问题,因为当您构建到生产模式时,您的代码正在查找此文件 ./node_modules/@angular/service-worker/config/schema.json
所以你的服务人员将无法工作
添加回答
举报