import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

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: {
    port: 5173,
    proxy: {
      '/api': {
        target: 'http://localhost:5001',
        changeOrigin: true
      },
      '/static': {
        target: 'http://localhost:5001',
        changeOrigin: true
      }
    }
  }
})
