chore(dev): Improve Vite hot reloading in Docker environment

- Add CHOKIDAR_USEPOLLING=true to frontend service environment
- Update Node.js version to 18 in frontend Dockerfile
- Create vite.config.js with usePolling option enabled
This commit is contained in:
santiagosayshey
2024-08-16 08:48:28 +09:30
committed by Sam Chau
parent 397d9918f1
commit 123cefa6e8
3 changed files with 7 additions and 4 deletions

View File

@@ -1,5 +1,4 @@
version: '3.8'
services:
frontend:
build: ./frontend
@@ -9,11 +8,12 @@ services:
- ./frontend:/app
- /app/node_modules
environment:
- VITE_API_URL=http://backend:5000 # Use the service name
- VITE_API_URL=http://backend:5000
- CHOKIDAR_USEPOLLING=true
backend:
build: ./backend
ports:
- "5000:5000"
volumes:
- ./backend:/app
- ./backend:/app

View File

@@ -1,4 +1,4 @@
FROM node:16
FROM node:18
WORKDIR /app

View File

@@ -6,5 +6,8 @@ export default defineConfig({
server: {
host: '0.0.0.0',
port: 3000,
watch: {
usePolling: true,
},
},
})