29 lines
760 B
JavaScript
29 lines
760 B
JavaScript
|
|
import { defineConfig } from 'vite';
|
||
|
|
import react from '@vitejs/plugin-react';
|
||
|
|
import tailwindcss from '@tailwindcss/vite';
|
||
|
|
|
||
|
|
// The dev server proxies /api to the Go backend so the SPA and the API share an
|
||
|
|
// origin during development. CORS stays enabled on the backend for anyone who
|
||
|
|
// prefers to call it cross-origin instead.
|
||
|
|
const BACKEND = process.env.GO_DOC_BACKEND ?? 'http://127.0.0.1:8080';
|
||
|
|
|
||
|
|
export default defineConfig({
|
||
|
|
plugins: [react(), tailwindcss()],
|
||
|
|
server: {
|
||
|
|
port: 5173,
|
||
|
|
strictPort: true,
|
||
|
|
host: '127.0.0.1',
|
||
|
|
proxy: {
|
||
|
|
'/api': {
|
||
|
|
target: BACKEND,
|
||
|
|
changeOrigin: true,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
build: {
|
||
|
|
outDir: 'dist',
|
||
|
|
emptyOutDir: true,
|
||
|
|
sourcemap: false,
|
||
|
|
chunkSizeWarningLimit: 900,
|
||
|
|
},
|
||
|
|
});
|