N
N
n1ksON2020-11-23 23:08:04
React
n1ksON, 2020-11-23 23:08:04

Where did serviceWorker.js go?

Deployed the project with create-react-app. After installing firebase, the serviceWorker.js file disappeared - the standard file that appears when the project is deployed. Instead, the reportWebVitals.js file appeared. Googled, this is some new feature from Google used for optimization.
Tell me how it is generally connected and is serviceWorker.js needed for the full operation of the React application? If I understand correctly, serviceWorker.js is needed for the application to work properly offline.
Or tell me where you can read more about it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wondermarin, 2020-11-24
@n1ksON

Service Worker has become optional since version 4 of CRA and is needed to create a PWA.
You can find more about this in the documentation .

Starting with Create React App 4, you can add a src/service-worker.jsfile to your project to use the built-in support for Workbox's InjectManifestplugin, which will compile your service worker and inject into it a list of URLs to precache.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question