2026-08-28 15:06:01 +08:00
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
|
import { fileURLToPath, URL } from 'node:url';
|
|
|
|
|
|
|
|
|
|
// 让 import 路径与项目文件夹名(bj_power_dashboard)对齐
|
|
|
|
|
const dashboardAlias = '@bj_power_dashboard';
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
plugins: [react()],
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
[dashboardAlias]: fileURLToPath(new URL('./src', import.meta.url)),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
server: {
|
|
|
|
|
port: 5173,
|
2026-09-04 14:18:53 +08:00
|
|
|
// 大屏项目:启动后自动拉起浏览器,避免每次手动输地址
|
|
|
|
|
open: true,
|
|
|
|
|
host: true,
|
2026-08-28 15:06:01 +08:00
|
|
|
proxy: {
|
2026-09-04 14:18:53 +08:00
|
|
|
// 开发环境代理到 MES(实际端口 8888,早期写 8000 导致连不上)
|
2026-08-28 15:06:01 +08:00
|
|
|
'/api': {
|
2026-09-04 14:18:53 +08:00
|
|
|
target: process.env.VITE_MES_BASE_URL || 'http://127.0.0.1:8888',
|
2026-08-28 15:06:01 +08:00
|
|
|
changeOrigin: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|