Files
Academic-Affairs-System/web-react/vite.config.ts

47 lines
1022 B
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { branding } from '../web/branding.config.ts'
function escapeHtml(value: string) {
return value
.replaceAll('&', '&')
.replaceAll('"', '"')
.replaceAll('<', '&lt;')
.replaceAll('>', '&gt;')
}
export default defineConfig({
base: '/next/',
define: {
__APP_BRANDING__: JSON.stringify(branding),
},
plugins: [
react(),
{
name: 'app-branding-html',
transformIndexHtml(html) {
return html
.replaceAll('__APP_PRODUCT_NAME__', escapeHtml(branding.productName))
.replaceAll('__APP_DESCRIPTION__', escapeHtml(branding.description))
},
},
],
build: {
outDir: 'dist',
emptyOutDir: true,
},
server: {
port: 5174,
proxy: {
'/api': {
target: 'http://localhost:5255',
changeOrigin: true,
},
'/health': {
target: 'http://localhost:5255',
changeOrigin: true,
},
},
},
})