You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.3 KiB
43 lines
1.3 KiB
import { defineConfig, mergeConfig } from "vite";
|
|
import { VitePWA } from "vite-plugin-pwa";
|
|
import { createBuildConfig } from "./vite.config.common.mts";
|
|
import { loadAppConfig } from "./vite.config.utils.mts";
|
|
|
|
export default defineConfig(async () => {
|
|
const baseConfig = await createBuildConfig('web');
|
|
const appConfig = await loadAppConfig();
|
|
|
|
return mergeConfig(baseConfig, {
|
|
base: process.env.NODE_ENV === 'production' ? 'https://timesafari.anomalistdesign.com/' : './',
|
|
plugins: [
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
manifest: appConfig.pwaConfig?.manifest,
|
|
devOptions: {
|
|
enabled: false
|
|
},
|
|
workbox: {
|
|
cleanupOutdatedCaches: true,
|
|
skipWaiting: true,
|
|
clientsClaim: 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]
|
|
}
|
|
}
|
|
}]
|
|
}
|
|
})
|
|
]
|
|
});
|
|
});
|
|
|