Skip to content

Commit 32c4285

Browse files
committed
avoid TypeError on when registering service workers without config
Fixes facebook#5299
1 parent 3a4414c commit 32c4285

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: packages/react-scripts/template/src/serviceWorker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function registerValidSW(swUrl, config) {
7878
console.log('Content is cached for offline use.');
7979

8080
// Execute callback
81-
if (config.onSuccess) {
81+
if (config && config.onSuccess) {
8282
config.onSuccess(registration);
8383
}
8484
}

0 commit comments

Comments
 (0)