Reputation: 1016
My React app isn't reloading on Docker for Windows with docker-compose and WSL2.
docker-compose.yml
frontend:
container_name: frontend
build:
context: ./github-finder-app
volumes:
- '/var/app/node_modules'
- './github-finder-app:/var/app'
ports:
- 3000:3000
stdin_open: true
environment:
- CHOKIDAR_USEPOLLING=true
command: npm start
Dockerfile
FROM node:14.9
WORKDIR /var/app
COPY . .
RUN npm install --only=prod
EXPOSE 3000
Been trying to play around with Chokidar, .env file and different Dockerfiles so far.
Upvotes: 2
Views: 1564
Reputation: 618
You can use WebPack packaging tool, by the way Hot Module Reload is not using on production in most case(Compact bundle will be running). "HMR is not intended for use in production, meaning it should only be used in development. See the building for production guide for more information."
Reference: https://webpack.js.org/guides/hot-module-replacement/
Upvotes: 2