import { mergeConfig } from 'vite'
// import eslint from 'vite-plugin-eslint'
import baseConfig from './vite.config.base'

const proxyTarget = (port: number) => ({
  target: `http://127.0.0.1:${port}`,
  changeOrigin: true,
})

export default mergeConfig(
  {
    mode: 'development',
    server: {
      open: true,
      host: '0.0.0.0',
      fs: {
        strict: true,
      },
      proxy: {
        '/rbac2': proxyTarget(10001),
        '/Alert': proxyTarget(12427),
        '/alert': proxyTarget(12427),
        '/DC-Control': proxyTarget(3031),
        '/dc-control': proxyTarget(3031),
        '/dc-network': proxyTarget(12429),
        '/DC-Hardware': proxyTarget(12450),
        '/dc-hardware': proxyTarget(12450),
        '/dc-host': proxyTarget(9030),
        '/dc-middleware': proxyTarget(12428),
        '/dc-database': proxyTarget(12580),
        '/Feedback': proxyTarget(12432),
        '/feedback': proxyTarget(12432),
        '/Assets': proxyTarget(12430),
        '/assets': proxyTarget(12430),
        '/Logs': proxyTarget(12440),
        '/logs': proxyTarget(12440),
        '/Kb': proxyTarget(12434),
        '/kb': proxyTarget(12434),
        '/Mgt': proxyTarget(12436),
        '/mgt': proxyTarget(12436),
        '/Visual': proxyTarget(12438),
        '/visual': proxyTarget(12438),
      },
    },
    plugins: [
      // eslint({
      //   cache: false,
      //   include: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.vue'],
      //   exclude: ['node_modules'],
      // }),
    ],
  },
  baseConfig
)
