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

export default defineConfig({
  base: './',
  publicDir: 'static',
  plugins: [
    vue({
      template: {
        compilerOptions: {
          compatConfig: {
            MODE: 2
          }
        }
      }
    })
  ],
  resolve: {
    extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
    alias: {
      vue: '@vue/compat',
      '@': path.resolve(__dirname, 'src'),
      imgs: path.resolve(__dirname, 'src/assets/imgs')
    }
  },
  define: {
    'process.env': {}
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '@import "@/styles/variables.scss"; @import "@/styles/mixin.scss";'
      }
    }
  },
  server: {
    host: true,
    port: 8080,
    proxy: {
      '/tenant': {
        target: 'http://114.104.160.233:28002',
        changeOrigin: true
      },
      '/platform': {
        target: 'http://114.104.160.233:28002',
        changeOrigin: true
      }
    }
  }
})
