All checks were successful
Deploy to Production / Trigger production update (push) Successful in 8s
Allow overriding the dep-optimizer cache dir via VITE_CACHE_DIR (the default node_modules/.vite is root-owned when built in Docker) and honor a PORT injected by the harness. Both default to prior behavior when the env vars are unset, so Docker builds are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import path from 'path'
|
|
|
|
const backendUrl = process.env.BACKEND_URL ?? 'http://localhost:8000'
|
|
|
|
export default defineConfig({
|
|
// Allow overriding the dep-optimizer cache dir (default node_modules/.vite is
|
|
// owned by root when the image is built in Docker, so local `vite` can't write).
|
|
cacheDir: process.env.VITE_CACHE_DIR || undefined,
|
|
plugins: [react(), tailwindcss()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
server: {
|
|
// Honor a port injected by the harness (e.g. preview autoPort); falls back to
|
|
// Vite's default 5173 when unset.
|
|
port: process.env.PORT ? Number(process.env.PORT) : undefined,
|
|
proxy: {
|
|
'/api': {
|
|
target: backendUrl,
|
|
changeOrigin: true,
|
|
},
|
|
'/proxmox': {
|
|
target: backendUrl,
|
|
changeOrigin: true,
|
|
ws: true,
|
|
},
|
|
'/ws': {
|
|
target: backendUrl,
|
|
changeOrigin: true,
|
|
ws: true,
|
|
},
|
|
'/logs': {
|
|
target: backendUrl,
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
})
|