import vue from '@vitejs/plugin-vue'
import type { PluginOption } from 'vite'
import createAutoImport from './auto-import'
import createCompression from './compression'
import createSvgIcon from './svg-icon'

interface ViteEnv {
  VITE_BUILD_COMPRESS?: string
  // ... 其他环境变量
}
export default function createVitePlugins(viteEnv: ViteEnv, isBuild = false) {
  const vitePlugins: PluginOption[] = [vue()]
  vitePlugins.push(...createAutoImport())
  vitePlugins.push(createSvgIcon(isBuild))
  isBuild && vitePlugins.push(...createCompression(viteEnv))
  return vitePlugins
}
