Service Worker registration error: Unsupported MIME type (‘text/html’)

Applying this change:

'/service-worker.js'  // ❌
'./service-worker.js' // ✅

fixed my issue.

(in navigator.serviceWorker.register('/service-worker.js'))


Or maybe you need:

'%PUBLIC_URL%/serviceworker.js'

Thank @DanielLord for his comment.

Leave a Comment

tech