React + Dockerでホットリロードが動かない時の対処方法「CHOKIDAR_USEPOLLING」を設定
動かない理由
If the project runs inside a virtual machine such as (a Vagrant provisioned) VirtualBox, create an .env file in your project directory if it doesn’t exist, and add CHOKIDAR_USEPOLLING=true to it. This ensures that the next time you run npm start, the watcher uses the polling mode, as necessary inside a VM.
要は仮想環境(VirtualBoxやVagrant)の時は。CHOKIDAR_USEPOLLINGを設定するとのことです。
対象方法
CHOKIDAR_USEPOLLING をtrue に設定します。
CHOKIDAR_USEPOLLING=true
参考
React+Dockerの関連記事
その他参考記事は以下です。