fix: 还原配置

This commit is contained in:
ChenZhaoYu
2023-02-22 22:55:53 +08:00
parent c0f8e4316e
commit b84f7e4c72
4 changed files with 12 additions and 7 deletions

View File

@@ -1,13 +1,10 @@
import path from 'path'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import { createViteProxy } from './config'
export default defineConfig((env) => {
const viteEnv = loadEnv(env.mode, process.cwd()) as unknown as ImportMetaEnv
const isOpenProxy = viteEnv.VITE_GLOB_HTTP_PROXY === 'Y'
return {
resolve: {
alias: {
@@ -19,7 +16,13 @@ export default defineConfig((env) => {
host: '0.0.0.0',
port: 1002,
open: false,
proxy: createViteProxy(isOpenProxy, viteEnv),
proxy: {
'/api': {
target: viteEnv.VITE_APP_API_BASE_URL,
changeOrigin: true, // 允许跨域
rewrite: path => path.replace('/api/', '/'),
},
},
},
build: {
reportCompressedSize: false,