mirror of
https://github.com/HKUDS/OpenSpace.git
synced 2026-08-28 05:15:00 +00:00
35 lines
727 B
TypeScript
35 lines
727 B
TypeScript
import { defineConfig, loadEnv } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import path from 'path';
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, __dirname, '');
|
|
const port = Number(env.VITE_PORT || 3888);
|
|
const host = env.VITE_HOST || '127.0.0.1';
|
|
const apiProxyTarget = env.VITE_API_PROXY_TARGET || 'http://127.0.0.1:7788';
|
|
const proxy = {
|
|
'/api': {
|
|
target: apiProxyTarget,
|
|
changeOrigin: true,
|
|
},
|
|
};
|
|
|
|
return {
|
|
plugins: [react()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
server: {
|
|
host,
|
|
port,
|
|
proxy,
|
|
},
|
|
preview: {
|
|
host,
|
|
port,
|
|
proxy,
|
|
},
|
|
};
|
|
});
|