Files
cameleer-server/ui/vite.config.ts
hsiegeln d942425cb1
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m16s
CI / docker (push) Successful in 1m8s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 37s
fix: use relative base path for Vite assets
When the server-ui is deployed under a subpath (/t/{slug}/), absolute
asset paths (/assets/...) resolve to the domain root instead of the
subpath, causing 404s. Using './' makes asset URLs relative to the
HTML page, so they resolve correctly regardless of mount path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 20:52:49 +02:00

35 lines
857 B
TypeScript

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// Use VITE_API_TARGET to proxy to a remote server, e.g.:
// VITE_API_TARGET=https://api.cameleer.siegeln.net npm run dev
const apiTarget = process.env.VITE_API_TARGET || 'http://localhost:8081';
export default defineConfig({
define: {
__APP_VERSION__: JSON.stringify((process.env.VITE_APP_VERSION || 'dev').slice(0, 7)),
},
plugins: [react()],
server: {
proxy: {
'/api/': {
target: apiTarget,
changeOrigin: true,
secure: false,
configure: (proxy) => {
proxy.on('proxyReq', (proxyReq) => {
proxyReq.removeHeader('origin');
});
},
},
},
},
optimizeDeps: {
include: ['swagger-ui-dist/swagger-ui-bundle'],
},
base: './',
build: {
outDir: 'dist',
},
});