vite.config.ts 614 Bytes
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vite';
import { createShellConfig } from '@uj/vite-config/shell';

const appDir = path.dirname(fileURLToPath(import.meta.url));

export default defineConfig(() => {
  // 后端地址解析交给浏览器侧 platform-core 的 backend-resolver.ts(同源优先、VITE_API_TARGET 覆盖),
  // dev server 不再挂 /api 代理,故这里无需读 env / 传 target。
  // .env 变更仍会触发重启(见 createShellConfig 内的 reload 插件)。
  return createShellConfig({ appDir, port: 5173 });
});