Files
atlas-seller-kit/apps/web/vite.config.ts
2026-09-28 17:34:33 +08:00

28 lines
924 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// 前端开发服务器:/api 代理到本地 NestJS API(apps/api,默认 8200)
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
// 浏览器直接编译共享契约源码,新增导出无需等待 CommonJS 预打包缓存刷新。
'@atlas/contracts': fileURLToPath(
new URL('../../packages/contracts/src/index.ts', import.meta.url)
),
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
port: Number(process.env.WEB_PORT ?? 8100),
strictPort: true,
proxy: {
'/api': {
target: process.env.API_ORIGIN ?? 'http://localhost:8200',
changeOrigin: true,
},
},
},
});