The python server suggested in the tutorial serves the sw.js service worker file (the crux of this tutorial) with a content-type=text/plain header instead of the required content-type=application/json; charset=UTF-8. This causes chrome to give an error:
DOMException: Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/plain').
I have added a very simple express server to this repo that fixes that issue by serving the file with the proper content-type.
Sorry for the delay in replying. I think this can be acheived instead by the serve module, which we could inlcude as a devDep rather than implementing an entire in the code.
The python server suggested in the tutorial serves the
sw.js
service worker file (the crux of this tutorial) with acontent-type=text/plain
header instead of the requiredcontent-type=application/json; charset=UTF-8
. This causes chrome to give an error:I have added a very simple express server to this repo that fixes that issue by serving the file with the proper
content-type
.