import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import path from 'path' // Dev proxy target for /api and /static. Default is the local Flask dev server. // To develop against a backend on another box, set it per shell, never here: // VITE_DEV_API_TARGET=https://10.0.0.5:5001 npm run dev // Certificates on such a box are usually self-signed, so verification is off by // default; VITE_DEV_SECURE=true turns it back on for an https target. const devApiTarget = process.env.VITE_DEV_API_TARGET || 'http://localhost:5001' const devApiSecure = devApiTarget.startsWith('https:') && process.env.VITE_DEV_SECURE === 'true' const devProxy = { target: devApiTarget, changeOrigin: true, secure: devApiSecure } export default defineConfig({ // Mount path of the built app. Default '/' (own IIS site / dev). Set // VITE_BASE_PATH='/ops/' (trailing slash) to build for a subpath mount under // Default Web Site, e.g. `VITE_BASE_PATH=/ops/ npm run build`. base: process.env.VITE_BASE_PATH || '/', plugins: [vue()], resolve: { alias: { '@': path.resolve(__dirname, './src') } }, server: { // all interfaces, so a VM or phone on the LAN can load the dev server host: true, port: 5173, proxy: { '/api': { ...devProxy }, '/static': { ...devProxy } } } })