import { svelte, vitePreprocess } from '@sveltejs/vite-plugin-svelte'; import tailwindcss from '@tailwindcss/vite'; import { viteSingleFile } from 'vite-plugin-singlefile'; import { defineConfig } from 'vite'; import { fileURLToPath } from 'node:url'; // Builds the keepsake viewer as ONE self-contained index.html (all JS + CSS // inlined) so it renders when opened via file://. Uses the plain Svelte plugin // (not SvelteKit) because SvelteKit emits multiple module entry points, which // cannot be inlined into a single file. export default defineConfig({ plugins: [ tailwindcss(), svelte({ configFile: false, preprocess: vitePreprocess(), compilerOptions: { runes: true } }), viteSingleFile() ], resolve: { alias: { $lib: fileURLToPath(new URL('./src/lib', import.meta.url)) } }, build: { outDir: fileURLToPath(new URL('../../backend/static/export-viewer', import.meta.url)), emptyOutDir: true, target: 'es2020' } });