React App is not reloading in devcontainer on windows 11

Viewed 505

I followed the instructions of this tutorial (https://youtu.be/KFyRLxiRKAc) and rewatched it several times but somehow it won't work for me. After I reopen the folder in the devcontainer and run npm start, the app is loading for several minutes until the browser opens localhost:3000 and presents the app. Now if I'm editing Code of the app, like changing the text of the create-react-app it won't reload at all. To detect changes I would have to restart the container but even that would take several minutes.

How can I solve the issue?

EDIT: I already tried setting CHOKIDAR_USEPOLLING=true and FAST_REFRESH=false but neither of them makes a difference

.devcontainer/.env

FAST_REFRESH=false
CHOKIDAR_USEPOLLING=true

.devcontainer/devcontainer.json

{
    "name": "Node.js",
    "build": {
        "dockerfile": "Dockerfile",
        "args": {
            "VARIANT": "16-bullseye"
        }
    },

    "settings": {},
    
    "extensions": [
        "dbaeumer.vscode-eslint"
    ],

    "forwardPorts": [
        3000
    ],

    "postCreateCommand": "npm install && npm start",
    "runArgs": [
        "--env-file",
        ".devcontainer/.env"
    ]
}

.devcontainer/Dockerfile

ARG VARIANT="16-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
1 Answers

You should do little bit of search in this forum. I'm quoting the answer:

Adding a .env file in the base path of the project and inside add FAST_REFRESH=false.

This disables fast refresh and returns to hot reload.

Related