import { defineConfig } from 'vite' import { getBuildRoutes } from './meta/routes.js' import preactPlugin from '@preact/preset-vite' import { join } from 'path' export default defineConfig(async () => { const routes = await getBuildRoutes() console.log('html entrypoints:') for (const [route, filename] of Object.entries(routes)) { console.log(`- "${route}" => ${filename}`) } console.log() const entryPoints = Object.values(routes) return { root: './frontend', publicDir: './frontend/public', build: { outDir: '../out/frontend', emptyOutDir: true, rollupOptions: { input: entryPoints.map(e => join('./frontend', e)), }, }, server: { proxy: { '/api': 'http://127.0.0.1:4000/', }, }, plugins: [preactPlugin()], } })