This website collects cookies to deliver better user experience
Turn your Create React App into a Progressive Web App in 100 seconds
Turn your Create React App into a Progressive Web App in 100 seconds
React Apps need two features to become Progressive Web Apps.
First, they need a service worker, which does work in the background of the app. Second, they need a manifest.json file in the public folder, which includes the name of the app, the home page, and icons.
If you're starting fresh, you can use the Create React App template cra-template-pwa (or cra-template-pwa-typescript) to bootstrap this process. If you want to create a React app from the start like this, use the command npx create-react-app app-name --template cra-template-pwa or npx create-react-app app-name --template cra-template-pwa-typescript.
But, if you're like me, you didn't think to add this template in the beginning, and are wondering how to add it to an existing app.
1. manifest.json
manifest.json goes in the public folder.
Most parts are self-explanatory. You can generate this file with websites like Simicart's.
Here's an example. Note that this requires favicon.ico, logo192.png, and logo512.png to be available in the public folder.