Files
sofarr/client/vite.config.js
T
gronod 6f2901b08c
Build and Push Docker Image / build (push) Successful in 2m6s
Licence Check / Licence compatibility and copyright header verification (push) Successful in 2m23s
CI / Security audit (push) Successful in 3m6s
CI / Swagger Validation & Coverage (push) Successful in 3m17s
CI / Tests & coverage (push) Failing after 3m51s
fix: resolve frontend connection issues by introducing concurrent startup and dynamic proxy configuration
2026-05-28 08:03:29 +01:00

41 lines
1.1 KiB
JavaScript

// Copyright (c) 2026 Gordon Bolton. MIT License.
import { defineConfig, loadEnv } from 'vite'
import path from 'path'
export default defineConfig(({ mode }) => {
// Load env variables from root directory to match backend TLS configuration
const env = loadEnv(mode, path.resolve(__dirname, '..'), '');
const port = env.PORT || 3001;
const tlsEnabled = (env.TLS_ENABLED || 'true').toLowerCase() !== 'false';
const target = `${tlsEnabled ? 'https' : 'http'}://localhost:${port}`;
return {
build: {
outDir: '../public',
emptyOutDir: false,
rollupOptions: {
input: {
main: './src/main.js'
},
output: {
entryFileNames: 'app.js',
chunkFileNames: '[name].js',
assetFileNames: '[name][extname]'
}
}
},
server: {
port: 5173,
host: true, // Listen on all network interfaces
proxy: {
'/api': {
target: target,
changeOrigin: true,
secure: false // Allow self-signed certificate in development
}
}
}
};
});