import { defineConfig } from 'vite' import { preact } from '@preact/preset-vite' export default defineConfig(({ isSsrBuild }) => { const entry = process.env.VITE_ENTRY || 'public' return { plugins: [preact()], root: new URL('./client', import.meta.url).pathname, publicDir: new URL('./client/static', import.meta.url).pathname, build: { outDir: new URL('./dist', import.meta.url).pathname, emptyOutDir: false, sourcemap: true, assetsInlineLimit: 0, copyPublicDir: !isSsrBuild && entry === 'public', manifest: isSsrBuild ? null : `manifest.${entry}.json`, rollupOptions: { input: { [entry]: new URL(`./client/${entry}/${isSsrBuild ? 'server' : 'client'}.ts`, import.meta.url).pathname, }, }, }, server: { allowedHosts: ['brf.local'], port: 3081, hmr: process.env.VITE_HMR_PROXY ? { clientPort: 443, } : false, }, } })