import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// import vueDevTools from 'vite-plugin-vue-devtools'

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueJsx(),
    AutoImport({
      imports: ['vue'],
      dts: 'src/auto-import.d.ts',
      resolvers: [ElementPlusResolver()]
    }),
    Components({
      resolvers: [ElementPlusResolver()]
    })
    // vueDevTools(),
  ],
  base: '/largeScreen/',
  server: {
    hmr: true,
    host: '0.0.0.0',
    proxy: {
      // '/sxzd': {
      //   // 目标服务器的地址
      //   target: 'http://localhost:63343/',
      //   changeOrigin: true
      // },
      // '/map/lqh': {
      //   // 目标服务器的地址
      //   target: 'http://localhost:63343/',
      //   changeOrigin: true
      // }
    }
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
    extensions: ['.js', '.vue']
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '@use "@/styles/screen.scss" as *;',
        javascriptEnabled: true
      }
    }
  }
})
