在控制台日志中引发错误该脚本具有不受支持的MIME类型('text / html')。
Service worker registration failed with: DOMException: Failed to register a ServiceWorker for scope ('https://localhost:4000/') with script ('https://localhost:4000/ngsw-worker.js'): The script has an unsupported MIME type ('text/html').
尝试
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production, scope: './', registrationStrategy: 'registerImmediately' })
在app.module.ts
内部