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

27 lines
997 B
TypeScript

import { defineConfig } from 'vite';
import preact from '@preact/preset-vite';
// Build artefact lives at apps/widget-discord/dist/. The deploy step (out
// of repo) rsyncs this into ~/vojo/widgets/discord/ on the server, which
// Caddy serves from /var/www/widgets/discord via the widgets.vojo.chat
// block — same shape as the Telegram widget, different sub-path.
//
// `base: './'` keeps every generated asset path relative so the same
// build can sit under /discord/ 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: {
// Port 8082 — telegram widget owns 8081, host SPA owns 8080.
// Both widget dev servers can run side by side without conflict.
port: 8082,
host: true,
},
});