Reputation: 21
I am trying to learn building PWAs and have been reading about this concept for the past few days. The problem I am facing is; whenever create a new react app with the help of npx, it never creates a serviceworker.js file.
Files after creating a new react project
All the articles and the YouTube tutorials show that npx create-react-app is creating that file for them. I have tried to google this issue but I think I am the only one who is facing this problem. I assume I can create a serviceworker.js file myself but I am curious that why npx is not doing this for me. I have tried to reinstall everything, tried to update everything but nothing is helping.
Upvotes: 2
Views: 552
Reputation: 2806
You have to install it with a pwa template:
npx create-react-app my-app --template cra-template-pwa
Then it's in the src
folder.
Make sure you have the latest node version installed for that.
Upvotes: 3