Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d3a177b7c | ||
|
|
07b84586b6 | ||
|
|
5267eb6ab1 |
@@ -30,7 +30,8 @@
|
|||||||
{
|
{
|
||||||
"glob": "**/*",
|
"glob": "**/*",
|
||||||
"input": "public"
|
"input": "public"
|
||||||
}
|
},
|
||||||
|
"src/sw.js"
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
"node_modules/bootstrap/dist/css/bootstrap.min.css",
|
"node_modules/bootstrap/dist/css/bootstrap.min.css",
|
||||||
|
|||||||
@@ -25,14 +25,6 @@
|
|||||||
"/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
|
"/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "excluded-redirects",
|
|
||||||
"installMode": "lazy",
|
|
||||||
"updateMode": "lazy",
|
|
||||||
"resources": {
|
|
||||||
"urls": [ "/**" ]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,8 @@ import { provideAnimationsAsync } from '@angular/platform-browser/animations/asy
|
|||||||
import { provideServiceWorker } from '@angular/service-worker';
|
import { provideServiceWorker } from '@angular/service-worker';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes),
|
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes), provideClientHydration(withEventReplay()), provideAnimationsAsync('noop'), provideServiceWorker('./sw.js', {
|
||||||
provideClientHydration(withEventReplay()), provideAnimationsAsync('noop'),
|
enabled: !isDevMode(),
|
||||||
provideServiceWorker('ngsw-worker.js', {
|
registrationStrategy: 'registerWhenStable:30000'
|
||||||
enabled: !isDevMode(),
|
|
||||||
registrationStrategy: 'registerWhenStable:30000'
|
|
||||||
})]
|
})]
|
||||||
};
|
};
|
||||||
|
|||||||
12
src/sw.js
Normal file
12
src/sw.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
self.addEventListener('fetch', event => {
|
||||||
|
if (event &&
|
||||||
|
event.request &&
|
||||||
|
event.request.url &&
|
||||||
|
// check if basename includes a dot, i.e. if it is not a file
|
||||||
|
! event.request.url.split(/[\\/]/).pop().includes(".")
|
||||||
|
) {
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
self.importScripts('./ngsw-worker.js');
|
||||||
Reference in New Issue
Block a user