vojo/apps/widget-whatsapp/vite.config.ts

27 lines
948 B
TypeScript

import { defineConfig } from 'vite';
import preact from '@preact/preset-vite';
// Build artefact lives at apps/widget-whatsapp/dist/. The deploy step
// (out of repo) rsyncs this into ~/vojo/widgets/whatsapp/ on the server,
// which Caddy serves from /var/www/widgets/whatsapp via the
// widgets.vojo.chat block.
//
// `base: './'` keeps every generated asset path relative so the same
// build can sit under /whatsapp/ on widgets.vojo.chat without rewrites.
export default defineConfig({
base: './',
plugins: [preact()],
build: {
target: 'es2020',
sourcemap: true,
// Inline CSS for a single round-trip; the widget is small and the
// host's iframe handshake budget is already tight (10s default).
cssCodeSplit: false,
},
server: {
// Different port from widget-telegram (8081) and widget-discord (8082)
// so all three can run side-by-side during local development.
port: 8083,
host: true,
},
});