import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import fs from 'node:fs'; import path from 'node:path'; import { listAllRoutePaths } from './src/data/routePaths.js'; const SITE_URL = 'https://convert.ombrora.com'; function writeSitemap(outDir) { const paths = listAllRoutePaths(); const lastmod = new Date().toISOString().slice(0, 10); const urls = paths .map((p) => ` \n ${SITE_URL}${p}/\n ${lastmod}\n `) .join('\n'); const sitemap = `\n\n${urls}\n\n`; fs.writeFileSync(path.join(outDir, 'sitemap.xml'), sitemap); } export default defineConfig({ plugins: [react()], server: { proxy: { '/api': 'http://localhost:3000', }, }, ssgOptions: { dirStyle: 'nested', // 'defer' (not 'async'): the entry module reads window.__VITE_REACT_SSG_HASH__, // which is set by a plain inline