Update vite.config.ts
Browse files- vite.config.ts +13 -17
vite.config.ts
CHANGED
|
@@ -1,27 +1,23 @@
|
|
| 1 |
-
import { defineConfig } from 'vite'
|
| 2 |
-
import react from '@vitejs/plugin-react'
|
| 3 |
|
| 4 |
export default defineConfig({
|
| 5 |
plugins: [react()],
|
| 6 |
server: {
|
|
|
|
|
|
|
| 7 |
proxy: {
|
|
|
|
| 8 |
'/api': {
|
| 9 |
-
target: 'http://localhost:3001',
|
| 10 |
changeOrigin: true,
|
|
|
|
| 11 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
},
|
| 13 |
-
allowedHosts: [
|
| 14 |
-
'twanapi-uploadv2.hf.space',
|
| 15 |
-
|
| 16 |
-
],
|
| 17 |
-
host: '0.0.0.0',
|
| 18 |
-
port: 5173,
|
| 19 |
-
},
|
| 20 |
-
esbuild: {
|
| 21 |
-
drop: ['console', 'debugger'],
|
| 22 |
-
},
|
| 23 |
-
build: {
|
| 24 |
-
sourcemap: false,
|
| 25 |
-
minify: 'esbuild',
|
| 26 |
},
|
| 27 |
-
})
|
|
|
|
| 1 |
+
import { defineConfig } from 'vite'
|
| 2 |
+
import react from '@vitejs/plugin-react' // hoặc vue tùy project của bạn
|
| 3 |
|
| 4 |
export default defineConfig({
|
| 5 |
plugins: [react()],
|
| 6 |
server: {
|
| 7 |
+
host: '0.0.0.0', // Bắt buộc để chạy trên Docker
|
| 8 |
+
port: 5173, // Port chính của Space
|
| 9 |
proxy: {
|
| 10 |
+
// Cấu hình Proxy: Mọi request bắt đầu bằng /api sẽ được chuyển sang Backend
|
| 11 |
'/api': {
|
| 12 |
+
target: 'http://localhost:3001', // Port của Backend
|
| 13 |
changeOrigin: true,
|
| 14 |
+
secure: false,
|
| 15 |
},
|
| 16 |
+
// Nếu bạn có dùng socket.io thì thêm đoạn này, không thì bỏ qua
|
| 17 |
+
'/socket.io': {
|
| 18 |
+
target: 'http://localhost:3001',
|
| 19 |
+
ws: true,
|
| 20 |
+
}
|
| 21 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
},
|
| 23 |
+
})
|