I ran npx create-react-app my-app --template cra-template-pwa-typescript
to create a typescript PWA template following the docs and then I changed serviceWorker.unregister();
in index.js to serviceWorker.register();
and ran the development build, but chrome can't seem to find the service worker, Lighthouse returns : "No matching service worker detected. You may need to reload the page, or check that the scope of the service worker for the current page encloses the scope and start URL from the manifest."
is there anything else I have to do to make it work?
You should read the official document, there are very detailed instructions.
Service workers require HTTPS, although to facilitate local testing, that policy does not apply to localhost.
The service worker is only enabled in the production environment.