mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 添加网络代理
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { fileURLToPath } from 'url';
|
||||
import { defineConfig, loadEnv } from 'vite';
|
||||
import { setupVitePlugins, define } from './build';
|
||||
import { getEnvConfig } from './.env-config';
|
||||
|
||||
export default defineConfig((configEnv) => {
|
||||
const viteEnv = loadEnv(configEnv.mode, `.env.${configEnv.mode}`) as ImportMetaEnv;
|
||||
@ -8,6 +9,8 @@ export default defineConfig((configEnv) => {
|
||||
const srcPath = fileURLToPath(new URL('./src', import.meta.url));
|
||||
const rootPath = fileURLToPath(new URL('./', import.meta.url));
|
||||
|
||||
const { http } = getEnvConfig(viteEnv);
|
||||
|
||||
return {
|
||||
base: viteEnv.VITE_BASE_URL,
|
||||
resolve: {
|
||||
@ -32,6 +35,13 @@ export default defineConfig((configEnv) => {
|
||||
host: '0.0.0.0',
|
||||
port: 3200,
|
||||
open: true,
|
||||
proxy: {
|
||||
[http.proxy]: {
|
||||
target: http.url,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(new RegExp(`^${http.proxy}`), ''),
|
||||
},
|
||||
},
|
||||
},
|
||||
build: {
|
||||
brotliSize: false,
|
||||
|
Reference in New Issue
Block a user