with my Docker file
FROM node
WORKDIR /app
COPY package*.json .
RUN npm install
COPY . .
CMD npm run dev
EXPOSE 4000
ENV NODE_ENV development
and docker compose
version: '3.8'
services:
app:
build: .
container_name: train_vite
working_dir: /app/
ports:
- "4000:4000"
volumes:
- ./:/var/www/html/app
command:
- npm run install
- npm run dev
environment:
NODE_ENV: development
and vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
server:{watch:{
usePolling:true,
},
host:true,
strictPort:true,
port:4000
}
})
throws an error like this
the command I run is
docker compose up
I try to run a docker image with the app folder linked to the docker folder (volume) to see the changes on live.