vite.config.js 484 Bytes
import { defineWebPreset } from '@drama/config'
import { defineConfig, loadEnv } from 'vite'
import { fileURLToPath } from 'node:url'

const appRoot = fileURLToPath(new URL('.', import.meta.url))

export default defineConfig(({ command, mode }) => {
  const appEnv = loadEnv(mode, appRoot, '')
  return defineWebPreset({
    root: '.',
    server: {
      port: 5201,
      proxy: { '/api': appEnv.VITE_API_PROXY || 'http://localhost:9201' },
    },
  }, { env: appEnv, command })
})