ForcePilot/web/vite.config.js

30 lines
715 B
JavaScript
Raw Normal View History

import { fileURLToPath, URL } from 'node:url'
2024-10-08 22:16:17 +08:00
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
2024-10-08 22:16:17 +08:00
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
return {
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
2024-10-08 22:16:17 +08:00
server: {
proxy: {
'^/api': {
target: env.VITE_API_URL || 'http://api:5050',
2024-10-08 22:16:17 +08:00
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '/api')
2024-10-08 22:16:17 +08:00
}
},
watch: {
usePolling: true,
2024-10-08 22:16:17 +08:00
ignored: ['**/node_modules/**', '**/dist/**'],
},
host: '0.0.0.0',
}
}
})