Skip to content

[v4.0.1] Environment variable CHOKIDAR_USEPOLLING only works without the "REACT_APP_" prefix #10197

@bennettdams

Description

@bennettdams

Describe the bug

The environment variable CHOKIDAR_USEPOLLING is ignored in .env* files when using the REACT_APP_ prefix.
When using it without REACT_APP_, it is working fine.

I have a development setup inside a Docker container (Debian) with VS Code, so for Webpack to pick up changes, I need to use CHOKIDAR_USEPOLLING=true. Without that environment variable, changes in the code are ignored by Webpack.

What works:

  • in package.json: { ... "start": "CHOKIDAR_USEPOLLING=true react-scripts start" ... }
  • in any dotenv file (like .env.development): CHOKIDAR_USEPOLLING=true

What does not work:

  • in any dotenv file (like .env.development): REACT_APP_CHOKIDAR_USEPOLLING=true

Environment

  System:
    OS: Windows 10 10.0.19041
    Node: v14.15.1
    NPM: 6.14.8
    VS Code: 1.51.1
  npmPackages:
    react: ^17.0.1 => 17.0.1
    react-dom: ^17.0.1 => 17.0.1
    react-scripts: 4.0.1 => 4.0.1

Steps to reproduce

Disclaimer: I'm not sure whether this happens also without VS Code & Remote Containers.

  1. Open a folder in a VS Code Remote Container
  2. npx create-react-app my-app --template typescript --use-npm
  3. npm start
  4. Make changes in App.tsx and save
    => Webpack dev server did not reload/did not pick up the changes
  5. Create .env.development
  6. Add REACT_APP_CHOKIDAR_USEPOLLING=true
  7. Kill process and do npm start again
  8. Make changes in App.tsx and save
    => Webpack dev server STILL did not reload/did not pick up the changes
  9. Change REACT_APP_CHOKIDAR_USEPOLLING=true to CHOKIDAR_USEPOLLING=true (remove REACT_APP_)
  10. Kill process and do npm start again
  11. Make changes in App.tsx and save
    => Webpack finally picks up the changes

Expected behavior

I would expect the env variable REACT_APP_CHOKIDAR_USEPOLLING to work.

Actual behavior

..but it only works without the REACT_APP_ prefix.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions