Yves Gurcan
Senior software engineer with a passion for developing bleeding edge web applications and event-driven architecture. More talks and resources at https://connect.yvesgurcan.com.
// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { VitePWA } from "vite-plugin-pwa";
export default defineConfig({
plugins: [
react(),
VitePWA({
strategies: "injectManifest",
srcDir: "src",
filename: "serviceWorker.ts",
registerType: "autoUpdate",
devOptions: {
enabled: true,
},
}),
],
build: {
outDir: "../dist",
},
});
// serviceWorker.ts
import {precacheAndRoute} from 'workbox-precaching';
precacheAndRoute(self.__WB_MANIFEST);
// serviceWorker.ts
import { googleFontsCache } from "workbox-recipes";
googleFontsCache();
By Yves Gurcan
Senior software engineer with a passion for developing bleeding edge web applications and event-driven architecture. More talks and resources at https://connect.yvesgurcan.com.