import react from '@vitejs/plugin-react' import compression from 'compression' import { defineConfig, type Connect, type Plugin } from 'vite' // `vite preview` is what serves the built site, and nothing in front of it // compresses (frp only tunnels), so the files are gzipped here. const gzipPreview: Plugin = { name: 'gzip-preview', configurePreviewServer(server) { // Typed for Express, and at home in any Node server. server.middlewares.use(compression() as Connect.NextHandleFunction) }, } // https://vite.dev/config/ export default defineConfig({ plugins: [react(), gzipPreview], preview: { host: true, port: 5173, allowedHosts: ['the-sunken-reach.crosscode.co.za'], }, })