Create-react-app: Hot reloading does not work in docker

Created on 4 Feb 2018  路  2Comments  路  Source: facebook/create-react-app

I generated react application using npx create-react-app my-app
everything works fine in my local machine and I used npm start and hot reload works.
but when I started to use this application in docker container I missed hot reloading feature
using following command I created docker container and mounted volume on it:
docker run -p 3000:3000 -v "$(pwd):/var/www" -w "/var/www" node npm start
react app comes up and works properly but after changing code it does not affect on this project.

Most helpful comment

See CHOKIDAR_USEPOLLING as suggested by our troubleshooting guide.

All 2 comments

See CHOKIDAR_USEPOLLING as suggested by our troubleshooting guide.

Setting CHOKIDAR_USEPOLLING to true sent my docker CPU usage through the roof.

Enabling "warm reloading" was enough for my needs (reloads the browser when a file changes, but loses state).

You'll need to expose port 35729, if you're interested see https://www.peterbe.com/plog/how-to-create-react-app-with-docker.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jnachtigall picture jnachtigall  路  3Comments

adrice727 picture adrice727  路  3Comments

Evan-GK picture Evan-GK  路  3Comments

fson picture fson  路  3Comments

DaveLindberg picture DaveLindberg  路  3Comments