import { defineConfig } from 'vite' import { svelte } from '@sveltejs/vite-plugin-svelte' import { VitePWA } from 'vite-plugin-pwa' import fs from 'fs' import path from 'path' // Read bicorder.json at build time const bicorderData = JSON.parse( fs.readFileSync(path.resolve(__dirname, '../bicorder.json'), 'utf-8') ) export default defineConfig({ base: './', plugins: [ svelte(), VitePWA({ registerType: 'autoUpdate', includeAssets: ['favicon.ico'], manifest: { name: 'Protocol Bicorder', short_name: 'Bicorder', description: 'A diagnostic tool for the study of protocols', theme_color: '#ffffff', background_color: '#ffffff', display: 'standalone', icons: [ { src: '/icon.svg', sizes: 'any', type: 'image/svg+xml', purpose: 'any' } ] }, workbox: { globPatterns: ['**/*.{js,css,html,ico,png,svg,json}'] } }) ], define: { '__BICORDER_DATA__': JSON.stringify(bicorderData) } })