43 خطوط
1.1 KiB
TypeScript
43 خطوط
1.1 KiB
TypeScript
import { defineConfig, loadEnv } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import path from 'path'
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), 'VITE_')
|
|
const backendUrl = env.VITE_BACKEND_URL?.trim() || 'http://127.0.0.1:8800'
|
|
const frontendHost = env.VITE_FRONTEND_HOST?.trim() || '127.0.0.1'
|
|
const frontendPort = Number(env.VITE_FRONTEND_PORT || 5173)
|
|
|
|
return {
|
|
plugins: [react(), tailwindcss()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
server: {
|
|
host: frontendHost,
|
|
port: frontendPort,
|
|
strictPort: true,
|
|
proxy: {
|
|
'/api': {
|
|
target: backendUrl,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
'/sanctum': {
|
|
target: backendUrl,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
'/storage': {
|
|
target: backendUrl,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
})
|