fixing style
Some checks failed
Build, test, and publish / Build and test (push) Has been cancelled
Build, test, and publish / Build and push Docker image (push) Has been cancelled
CI / test (push) Has been cancelled

This commit is contained in:
Daniel Noulet 2026-10-07 15:10:10 +02:00
parent e454940dfa
commit f40485842d
35 changed files with 16000 additions and 286 deletions

View file

@ -1,24 +1,41 @@
import { defineConfig } from 'vite'
import {defineConfig, loadEnv, type Plugin} from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
// Build into the repository root; the Dockerfile and `make ui` copy the result
// into the Go embed directory (cmd/server/web/dist).
build: {
outDir: '../dist',
emptyOutDir: true,
},
server: {
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
},
'/health': {
target: 'http://localhost:8080',
changeOrigin: true,
function themeContract(origin: string): Plugin {
const base = origin.replace(/\/+$/, '')
return {
name: 'go-bananas-contract',
transformIndexHtml(html) {
if (!base) return html
const tags = [
`<link rel="stylesheet" href="${base}/rt/v1/contract.css" data-theme-contract>`,
`<script type="module" src="${base}/rt/v1/components.js"></script>`,
].join('\n ')
return html.replace('</head>', ` ${tags}\n </head>`)
},
}
}
export default defineConfig(({mode}) => {
const env = loadEnv(mode, '.', '')
const themeOrigin = env.VITE_THEME_BASE_URL || ''
return {
plugins: [react(), themeContract(themeOrigin)],
build: {
outDir: '../dist',
emptyOutDir: true,
},
server: {
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
},
'/health': {
target: 'http://localhost:8080',
changeOrigin: true,
},
},
},
},
}
})