Skip to content

Commit daf8df1

Browse files
jeffposnickTimer
authored andcommitted
Add a localhost-only log message pointing folks to the PWA docs. (#3455)
1 parent 801fec2 commit daf8df1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/react-scripts/template/src/registerServiceWorker.js

+9
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ export default function register() {
3535
if (isLocalhost) {
3636
// This is running on localhost. Lets check if a service worker still exists or not.
3737
checkValidServiceWorker(swUrl);
38+
39+
// Add some additional logging to localhost, pointing developers to the
40+
// service worker/PWA documentation.
41+
navigator.serviceWorker.ready.then(() => {
42+
console.log(
43+
'This web app is being served cache-first by a service ' +
44+
'worker. To learn more, visit https://goo.gl/SC7cgQ'
45+
);
46+
});
3847
} else {
3948
// Is not local host. Just register service worker
4049
registerValidSW(swUrl);

0 commit comments

Comments
 (0)