PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, November 6, 2022

[FIXED] Why React app wont reloading in Docker-compose container

 November 06, 2022     docker, docker-compose, reactjs     No comments   

Issue

im trying to start my dev react app in Docker and developing it with live reload.

My Dockerfile:

FROM node:16.8.0-bullseye

WORKDIR /usr/src/app
COPY ./package.json .

RUN npm install
RUN npm install -g nodemon

COPY . .

CMD npm run start

My docker-compsoe.yml

version: '3'
services:
  app:
    build:
      dockerfile: ./Dockerfile.dev
    volumes:
      - ".:/usr/src/app"
      - "/usr/src/app/node_modules"
    ports:
      - 3000:3000
    environment:
      - CHOKIDAR_USEPOLLING=true

It starts server, but when I edit source code, it doesn't reload. What am I doing wrong?

Start React app in Docker and live reload on file changes


Solution

try to use WATCHPACK_POLLING=true instead of CHOKIDAR_USEPOLLING=true



Answered By - Layeb Mazen
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing