100 lines
2.7 KiB
TypeScript
100 lines
2.7 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
includeAssets: ['icon.svg'],
|
|
manifest: {
|
|
name: 'Deckerr - Card Deck Manager',
|
|
short_name: 'Deckerr',
|
|
description: 'Manage your trading card game decks on the go',
|
|
theme_color: '#0f172a',
|
|
background_color: '#0f172a',
|
|
display: 'standalone',
|
|
orientation: 'portrait',
|
|
scope: '/',
|
|
start_url: '/',
|
|
icons: [
|
|
{
|
|
src: 'icon.svg',
|
|
sizes: '512x512',
|
|
type: 'image/svg+xml',
|
|
purpose: 'any'
|
|
},
|
|
{
|
|
src: 'icon.svg',
|
|
sizes: '512x512',
|
|
type: 'image/svg+xml',
|
|
purpose: 'maskable'
|
|
}
|
|
],
|
|
categories: ['games', 'utilities'],
|
|
shortcuts: [
|
|
{
|
|
name: 'My Decks',
|
|
short_name: 'Decks',
|
|
description: 'View your deck collection',
|
|
url: '/?page=home'
|
|
},
|
|
{
|
|
name: 'Search Cards',
|
|
short_name: 'Search',
|
|
description: 'Search for cards',
|
|
url: '/?page=search'
|
|
},
|
|
{
|
|
name: 'Life Counter',
|
|
short_name: 'Life',
|
|
description: 'Track life totals',
|
|
url: '/?page=life-counter'
|
|
}
|
|
]
|
|
},
|
|
workbox: {
|
|
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2}'],
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: /^https:\/\/api\.scryfall\.com\/.*/i,
|
|
handler: 'CacheFirst',
|
|
options: {
|
|
cacheName: 'scryfall-cache',
|
|
expiration: {
|
|
maxEntries: 500,
|
|
maxAgeSeconds: 60 * 60 * 24 * 7 // 7 days
|
|
},
|
|
cacheableResponse: {
|
|
statuses: [0, 200]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
urlPattern: /^https:\/\/cards\.scryfall\.io\/.*/i,
|
|
handler: 'CacheFirst',
|
|
options: {
|
|
cacheName: 'card-images-cache',
|
|
expiration: {
|
|
maxEntries: 1000,
|
|
maxAgeSeconds: 60 * 60 * 24 * 30 // 30 days
|
|
},
|
|
cacheableResponse: {
|
|
statuses: [0, 200]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
devOptions: {
|
|
enabled: true
|
|
}
|
|
})
|
|
],
|
|
optimizeDeps: {
|
|
exclude: ['lucide-react'],
|
|
},
|
|
});
|