32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import { defineConfig } from 'vite'
|
|
|
|
import pkg from './package.json' with { type: 'json' }
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react(), tailwindcss()],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
},
|
|
},
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(pkg.version),
|
|
},
|
|
server: {
|
|
port: process.env.PORT ? Number(process.env.PORT) : 8094,
|
|
// Same-origin dev proxy for REST, files, and Tinode WebSocket. Production uses the same paths
|
|
// through Caddy, so local development must expose all three routes too.
|
|
proxy: {
|
|
'/v1/im': { target: 'http://127.0.0.1:6060', changeOrigin: true, secure: false },
|
|
'/v0/file': { target: 'http://127.0.0.1:6060', changeOrigin: true, secure: false },
|
|
'/v0/channels': { target: 'http://127.0.0.1:6060', changeOrigin: true, secure: false, ws: true },
|
|
'/legal': { target: 'http://127.0.0.1:6060', changeOrigin: true, secure: false },
|
|
},
|
|
},
|
|
})
|