import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; import vue from '@vitejs/plugin-vue'; import path from 'path'; import vuetify from "vite-plugin-vuetify"; import { VitePWA } from 'vite-plugin-pwa'; import { execSync } from 'child_process' function getAppVersion(): string { try { // Prefer a tag if one points at HEAD, else fall back to short hash return execSync('git describe --tags --always --dirty').toString().trim() } catch { return 'Unknown' } } export default defineConfig({ define: { __APP_VERSION__: JSON.stringify(process.env.VITE_APP_VERSION ?? 'Dev'), }, plugins: [ laravel({ input: 'resources/js/app.ts', refresh: true, }), vue({ template: { transformAssetUrls: { base: null, includeAbsolute: false, }, }, }), vuetify({ autoImport: true }), VitePWA({ base: '/', registerType: 'autoUpdate', strategies: 'injectManifest', srcDir: 'resources/js', filename: 'sw.js', injectManifest: { globPatterns: [], }, devOptions: { enabled: true, type: 'module', }, includeAssets: ['favicon.ico', 'apple-touch-icon-180.png'], manifest: { name: 'FlightsGoneBy', short_name: 'FlightsGoneBy', description: 'Track and log your flight history', start_url: '/', scope: '/', display: 'standalone', background_color: '#020d29', theme_color: '#020d29', icons: [ { src: '/img/app_icons/icon-192.png', sizes: '192x192', type: 'image/png' }, { src: '/img/app_icons/icon-512.png', sizes: '512x512', type: 'image/png' }, { src: '/img/app_icons/icon-192-maskable.png', sizes: '192x192', type: 'image/png', purpose: 'maskable' }, { src: '/img/app_icons/icon-512-maskable.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' }, ], }, }), ], resolve: { alias: { '@': path.resolve(__dirname, 'resources/js'), }, }, });