创建项目
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
// 加载环境变量
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
|
||||
return {
|
||||
plugins: [vue()],
|
||||
base: env.VITE_BASE_URL || '/',
|
||||
server: {
|
||||
port: parseInt(env.VITE_PORT) || 3000,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: env.VITE_API_URL || 'http://localhost:4000',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
}
|
||||
},
|
||||
host: true,
|
||||
allowedHosts: [
|
||||
'bsh.yw.hnzhwlkj.cn'
|
||||
]
|
||||
},
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user