-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
29 lines (27 loc) · 825 Bytes
/
vite.config.js
File metadata and controls
29 lines (27 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
port: 3000, // You can change the development port if needed
proxy: {
'/api': {
target: 'http://localhost:8080', // Your backend URL
changeOrigin: true, // <-- VERY IMPORTANT
secure: false, // Set to false if backend is http
// Rewrite the path: remove '/api' before sending to backend
// e.g., frontend requests /api/greet -> backend receives /greet
rewrite: (path) => path.replace(/^\/api/, ''),
}
}
}
})