Files
cameleer-server/ui/vite.config.ts
hsiegeln e7590d72fd
All checks were successful
CI / build (push) Successful in 1m23s
CI / cleanup-branch (push) Has been skipped
CI / docker (push) Successful in 50s
CI / deploy (push) Successful in 38s
CI / deploy-feature (push) Has been skipped
fix: restore Swagger UI on api-docs page
- Change Vite proxy pattern from /api to /api/ so /api-docs client
  route is not captured and proxied to the backend
- Fix SwaggerUIBundle init: remove empty presets/layout overrides that
  crashed the internal persistConfigs function
- Use correct CSS import (swagger-ui.css instead of index.css)
- Add requestInterceptor to auto-attach JWT token to Try-it-out calls
- Add swagger-ui-bundle to optimizeDeps.include for reliable loading
- Remove unused swagger-ui-dist.d.ts type declarations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:53:48 +01:00

31 lines
736 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({
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'],
},
build: {
outDir: 'dist',
},
});