import { fileURLToPath } from 'node:url' import tailwindcss from '@tailwindcss/vite' import vue from '@vitejs/plugin-vue' import { defineConfig } from 'vite' // In development the client talks to a homeserver through Vite's proxy, the // same paths warp-web proxies in production, so the code never needs to // know where the homeserver is. WARP_WEB_HOMESERVER points it elsewhere. const homeserver = process.env.WARP_WEB_HOMESERVER ?? 'http://localhost:8008' export default defineConfig({ plugins: [vue(), tailwindcss()], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) }, }, build: { // Embedded into the warp-web binary by client/ (and the desktop app). outDir: 'client/build/dist', emptyOutDir: true, assetsInlineLimit: 0, // matrix-js-sdk is most of the bundle; it is one chunk on purpose. chunkSizeWarningLimit: 1500, }, server: { port: 5175, proxy: { '/_matrix/client': { target: homeserver, changeOrigin: true }, '/_matrix/media': { target: homeserver, changeOrigin: true }, // Where the client finds the group call backend (rtc_foci). '/.well-known/matrix/client': { target: homeserver, changeOrigin: true }, }, }, })