Files
FreeERP.Antd.Admin/vite.config.ts
2026-01-27 14:04:37 +08:00

38 lines
955 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 path from 'node:path';
import react from '@vitejs/plugin-react';
// import { visualizer } from 'rollup-plugin-visualizer';
import { defineConfig } from 'vite';
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(), // 打包后生成体积分析报告dist/stats.html
// visualizer({
// // open: true, // 自动打开报告页面
// filename: 'stats.html',
// }),
],
base: './',
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
port: 4050,
host: '0.0.0.0',
proxy: {
'/api': {
target: 'http://www.free.loc',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''), // 不可以省略rewrite
},
'/static': {
target: 'http://www.free.loc',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''), // 不可以省略rewrite
},
},
},
});