初始化2
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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,
|
||||
proxy: {
|
||||
// 开发环境代理到 MES,避免跨域
|
||||
'/api': {
|
||||
target: process.env.VITE_MES_BASE_URL || 'http://127.0.0.1:8000',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user