Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bennettdams opened this issue Dec 4, 2020 · 4 comments

Comments

@bennettdams
Copy link

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.

@bennettdams bennettdams changed the title [v4.0.1] Environment variable CHOKIDAR_USEPOLLING only works when omitting "REACT_APP_" [v4.0.1] Environment variable CHOKIDAR_USEPOLLING only works without the "REACT_APP_" prefix Dec 4, 2020
@PrajjwalDatir
Copy link

Future readers,
For WSL 2 : ReactJS not reloading/ picking up changes after saved.
refer to #10253

@rahilarora07
Copy link

'CHOKIDAR_USEPOLLING' is not recognized as an internal or external command,
operable program or batch file.
It is showing this, what to do

@PrajjwalDatir
Copy link

'CHOKIDAR_USEPOLLING' is not recognized as an internal or external command,
operable program or batch file.
It is showing this, what to do

https://nerdschalk.com/how-to-fix-is-not-recognized-as-an-internal-or-external-command-operable-program-or-batch-file-error/ Try this probably

@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants