feat: added pwa functionality to vite

This commit is contained in:
Dan Ditomaso
2025-02-26 09:27:08 -05:00
parent fe2360baf6
commit 5831967603
4 changed files with 506 additions and 5 deletions
+14 -1
View File
@@ -1,5 +1,6 @@
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react';
import { VitePWA } from 'vite-plugin-pwa';
import { execSync } from 'node:child_process';
import path from 'path';
@@ -11,7 +12,19 @@ try {
}
export default defineConfig({
plugins: [react()],
plugins: [react(),
VitePWA({
registerType: 'autoUpdate',
strategies: 'generateSW',
devOptions: {
enabled: true
},
workbox: {
cleanupOutdatedCaches: true,
sourcemap: true
}
})
],
define: {
'process.env.COMMIT_HASH': JSON.stringify(hash),
},