File tree Expand file tree Collapse file tree 3 files changed +19
-14
lines changed
cra-template/template/src Expand file tree Collapse file tree 3 files changed +19
-14
lines changed Original file line number Diff line number Diff line change
1
+ /* eslint-disable no-restricted-globals */
2
+ import { clientsClaim } from 'workbox-core' ;
3
+ import { NavigationRoute , registerRoute } from 'workbox-routing' ;
4
+ import { precacheAndRoute , createHandlerBoundToURL } from 'workbox-precaching' ;
5
+
1
6
self . addEventListener ( 'message' , function ( event ) {
2
7
if ( event . data && event . data . type === 'SKIP_WAITING' ) {
3
8
self . skipWaiting ( ) ;
4
9
}
5
10
} ) ;
6
11
7
- workbox . core . clientsClaim ( ) ;
12
+ clientsClaim ( ) ;
8
13
9
- self . __precacheManifest = [ ] . concat ( self . __precacheManifest || [ ] ) ;
10
- workbox . precaching . precacheAndRoute ( self . __precacheManifest , { } ) ;
14
+ precacheAndRoute ( self . __WB_MANIFEST ) ;
11
15
12
- workbox . routing . registerNavigationRoute (
13
- workbox . precaching . getCacheKeyForURL ( '/index.html' ) ,
14
- {
15
- blacklist : [ new RegExp ( '^/_' ) , new RegExp ( '/[^/?]+\\.[^/]+$' ) ] ,
16
- }
17
- ) ;
16
+ const handler = createHandlerBoundToURL ( '/index.html' ) ;
17
+
18
+ const navigationRoute = new NavigationRoute ( handler , {
19
+ denylist : [ new RegExp ( '^/_' ) , new RegExp ( '/[^/?]+\\.[^/]+$' ) ] ,
20
+ } ) ;
21
+
22
+ registerRoute ( navigationRoute ) ;
Original file line number Diff line number Diff line change @@ -693,10 +693,10 @@ module.exports = function(webpackEnv) {
693
693
// navigateFallback: paths.publicUrlOrPath + 'index.html',
694
694
swSrc : `${ paths . appSrc } /sw.js` ,
695
695
swDest : `${ paths . appBuild } /service-worker.js` ,
696
- globDirectory : paths . appBuild ,
697
- importScripts : [
698
- 'https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js' ,
699
- ] ,
696
+ // globDirectory: paths.appBuild,
697
+ // importScripts: [
698
+ // 'https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js',
699
+ // ],
700
700
} ) ,
701
701
// TypeScript type checking
702
702
useTypeScript &&
Original file line number Diff line number Diff line change 79
79
"webpack" : " 4.41.5" ,
80
80
"webpack-dev-server" : " 3.10.2" ,
81
81
"webpack-manifest-plugin" : " 2.2.0" ,
82
- "workbox-webpack-plugin" : " 4.3.1 "
82
+ "workbox-webpack-plugin" : " 5.0.0 "
83
83
},
84
84
"devDependencies" : {
85
85
"react" : " ^16.12.0" ,
You can’t perform that action at this time.
0 commit comments