build: service-worker to TS

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/888/head
Varun Patil 2023-10-19 11:52:36 -07:00
parent bcd1764779
commit 77d91f81e8
4 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,8 @@
import { CacheExpiration } from 'workbox-expiration';
import { workerExport } from '../../worker';
declare var self: ServiceWorkerGlobalScope;
interface BlobCallback {
resolve: (blob: Blob) => void;
reject: (err: Error) => void;

View File

@ -3,6 +3,8 @@ import { NetworkFirst, CacheFirst } from 'workbox-strategies';
import { registerRoute } from 'workbox-routing';
import { ExpirationPlugin } from 'workbox-expiration';
declare var self: ServiceWorkerGlobalScope;
precacheAndRoute(self.__WB_MANIFEST);
cleanupOutdatedCaches();

View File

@ -2,6 +2,7 @@
"compilerOptions": {
"lib": [
"dom",
"WebWorker",
"es2017"
],
"target": "ES2017",

View File

@ -109,7 +109,7 @@ module.exports = {
// Bundle service worker
new WorkboxPlugin.InjectManifest({
swSrc: path.resolve(path.join('src', 'service-worker.js')),
swSrc: path.resolve(path.join('src', 'service-worker.ts')),
swDest: 'memories-service-worker.js',
maximumFileSizeToCacheInBytes: (isDev ? 10 : 4) * 1024 * 1024,
}),