77 lines
1.9 KiB
JavaScript
77 lines
1.9 KiB
JavaScript
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { VitePWA } from 'vite-plugin-pwa'
|
|
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
includeAssets: ['logo.png', 'favicon.ico'],
|
|
manifest: {
|
|
name: 'irandom',
|
|
short_name: 'irandom',
|
|
description: 'Random value generator',
|
|
theme_color: '#1a1815',
|
|
background_color: '#1a1815',
|
|
display: 'standalone',
|
|
orientation: 'any',
|
|
start_url: '/',
|
|
scope: '/',
|
|
lang: 'ru',
|
|
icons: [
|
|
{
|
|
src: '/logo.png',
|
|
sizes: '192x192',
|
|
type: 'image/png',
|
|
purpose: 'any'
|
|
},
|
|
{
|
|
src: '/logo.png',
|
|
sizes: '512x512',
|
|
type: 'image/png',
|
|
purpose: 'any maskable'
|
|
}
|
|
]
|
|
},
|
|
workbox: {
|
|
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2,webmanifest}'],
|
|
navigateFallback: '/index.html',
|
|
navigateFallbackDenylist: [/^\/api/],
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: ({ url }) => url.pathname.endsWith('/config.js'),
|
|
handler: 'NetworkFirst',
|
|
options: {
|
|
cacheName: 'irandom-config',
|
|
networkTimeoutSeconds: 3,
|
|
expiration: {
|
|
maxEntries: 1,
|
|
maxAgeSeconds: 60 * 60 * 24 * 30
|
|
},
|
|
cacheableResponse: {
|
|
statuses: [0, 200]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
devOptions: {
|
|
enabled: false
|
|
}
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, 'src')
|
|
}
|
|
},
|
|
server: {
|
|
port: 8080
|
|
}
|
|
})
|