CRA to PWA

Nov 19, 2020

This is the most searched topic on the internet today, “How to convert CRA (Create React App) to PWA (Progressive Web App)”.

To convert any website into PWA you’ve to add to files:

  1. manifest.json

  2. service-worker.js

image
CRA already has a basic service worker file for registering the service worker, just open ./src/index.js file and call the method serviceWorker.register(); or replace unregister() to register()

This will cache all the static files and assets and make the website work offline. CRA has a very little configuration of PWA to work on any smartphone and it doesn’t have an install popup configuration. So registering the service worker doesn’t make the app install on a smartphone. We need to configure it by ourselves.

STEPS

  1. Make the web app installable

  2. Add Windows and iPhone supported tags

  3. Configure the service worker to cache network images too, not only static images.

Read More: https://medium.com/swlh/cra-to-pwa-1e572207d7

Gefällt dir dieser Beitrag?

Kaufe manalliaquat einen Kaffee