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

export default mergeConfig(
  {
    mode: 'development',
    server: {
      proxy: {
        '/api/': {
          target: 'https://pmr.surkw.com:1443',
          secure: false,
          changeOrigin: true
        }
      }
    },
    plugins: [
      viteMockServe({
        ignore: /^_/,
        mockPath: 'src/mock',
        localEnabled: false,
        prodEnabled: true,
        injectCode: `
        import { setupProdMockServer } from './mock/_createProductionServer'
         setupProdMockServer()`
      }),
      eslint({
        cache: false,
        include: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.vue'],
        exclude: ['node_modules']
      })
    ]
  },
  baseConfig
)
