I used the simplest and the dumbest command
npx create-react-app mia-app
cd mia-app
npm start
But after created the project everytime there are no serviceWorker. Can someone help me?
However, I've tried with npm create-create-app with this res.
I used the simplest and the dumbest command
npx create-react-app mia-app
cd mia-app
npm start
But after created the project everytime there are no serviceWorker. Can someone help me?
However, I've tried with npm create-create-app with this res.
serviceWorker.js is no longer included in the base template, as of create-react-app version 4.0.something.
Trawling through the create-react-app GitHub issues, two main workarounds keep popping up:
npx create-react-app my-app --template cra-template-pwa
or for Typescript:
npx create-react-app my-app --template cra-template-pwa-typescript
(where my-app is replaced by the name of your app)
I had forgotten to change the call to unregister to register in serviceWorkerRegistration.ts. However, even after I did that, I didn't see a service worker show up. After looking at the register function, I realized that the service worker won't run on non-prod build so you'll have to address this issue How can i enable service worker in dev mode in create-react-app? if you want to see it with npm start. This is an unresolved issue as dev mode does not serve up service-worker.js
For who have the same problem as suggested by James Whiteley you can use the following command
npx create-react-app my-app --template <app-name>
For more info check this github issue https://github.com/facebook/create-react-app/issues/10104