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

const buildTime = new Date().toLocaleString('en-GB', { timeZone: 'Europe/London', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })

export default defineConfig({
  define: {
    __BUILD_TIME__: JSON.stringify(buildTime),
  },
  plugins: [vue()],
  server: {
    proxy: {
      '/api': `http://localhost:${process.env.VITE_API_PORT || 8000}`,
      '/uploads': `http://localhost:${process.env.VITE_API_PORT || 8000}`
    }
  },
  build: {
    outDir: 'dist'
  },
  test: {
    environment: 'jsdom',
    globals: true,
  }
})
