63 lines
1.5 KiB
JavaScript
63 lines
1.5 KiB
JavaScript
import { fileURLToPath, URL } from 'node:url'
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
|
import { VitePWA } from 'vite-plugin-pwa'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
vueDevTools(),
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
workbox: {
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: ({ request }) => request.destination === 'image',
|
|
handler: 'CacheFirst',
|
|
options: {
|
|
cacheName: 'images-cache',
|
|
expiration: {
|
|
maxEntries: 100,
|
|
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 Days
|
|
},
|
|
},
|
|
},
|
|
|
|
{
|
|
urlPattern: /^https:\/\/.*\/api\/v1\/.*/, // Cache API responses if needed, but focus on images
|
|
handler: 'NetworkFirst',
|
|
options: {
|
|
cacheName: 'api-cache',
|
|
}
|
|
}
|
|
]
|
|
},
|
|
manifest: {
|
|
name: 'AI Workspace',
|
|
short_name: 'AIWS',
|
|
theme_color: '#0f172a',
|
|
icons: [
|
|
{
|
|
src: 'pwa-192x192.png',
|
|
sizes: '192x192',
|
|
type: 'image/png'
|
|
},
|
|
{
|
|
src: 'pwa-512x512.png',
|
|
sizes: '512x512',
|
|
type: 'image/png'
|
|
}
|
|
]
|
|
}
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
},
|
|
},
|
|
})
|
|
|