diff --git a/vite.config.common.mts b/vite.config.common.mts index 62a50084..d875f569 100644 --- a/vite.config.common.mts +++ b/vite.config.common.mts @@ -25,7 +25,7 @@ export async function createBuildConfig(mode: string) { } return { - base: isElectron || isPyWebView ? "./" : "/", + base: isElectron || isPyWebView ? "./" : "./", plugins: [vue()], server: { port: parseInt(process.env.VITE_PORT || "8080"), diff --git a/vite.config.web.mts b/vite.config.web.mts index d27befaa..437b8fa8 100644 --- a/vite.config.web.mts +++ b/vite.config.web.mts @@ -8,6 +8,7 @@ export default defineConfig(async () => { const appConfig = await loadAppConfig(); return mergeConfig(baseConfig, { + base: process.env.NODE_ENV === 'production' ? 'https://timesafari.anomalistdesign.com/' : './', plugins: [ VitePWA({ registerType: 'autoUpdate', @@ -19,7 +20,22 @@ export default defineConfig(async () => { cleanupOutdatedCaches: true, skipWaiting: true, clientsClaim: true, - sourcemap: true + sourcemap: true, + navigateFallback: 'index.html', + runtimeCaching: [{ + urlPattern: /^https:\/\/timesafari\.anomalistdesign\.com\/.*/i, + handler: 'CacheFirst', + options: { + cacheName: 'timesafari-cache', + expiration: { + maxEntries: 50, + maxAgeSeconds: 60 * 60 * 24 * 30 // 30 days + }, + cacheableResponse: { + statuses: [0, 200] + } + } + }] } }) ]