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

Allow user to set WebpackDevServer watchOptions.poll option for react-scripts start #1049

Closed
spaugh opened this issue Nov 16, 2016 · 9 comments

Comments

@spaugh
Copy link

spaugh commented Nov 16, 2016

This could potentially be done by modifying the instantiation of the WebpackDevServer in start.js to look like:

...
watchOptions: {
  ignored: /node_modules/,
  poll: process.env.REACT_APP_POLL || undefined,
}
...

This use case is important to me (and others) because I'm developing in a Docker container, which has issues with inotify (due to mounting volumes with aufs), which precludes the automatic rebuild without the watchOptions poll setting.

@fson
Copy link
Contributor

fson commented Nov 16, 2016

We try to avoid config flags like this as much as possible. I wonder if it would be possible to somehow detect that we're in an environment like that and fall back to polling automatically.

@YAmikep
Copy link

YAmikep commented Nov 19, 2016

Same for me, I cannot count on inotify since I am using shared folders, vagrant and Virtualbox but I'd like to use polling as a workaround.

@fson
Copy link
Contributor

fson commented Nov 19, 2016

Chokidar, which Webpack uses for watching changes has an environment to force the use of polling: CHOKIDAR_USEPOLLING. Does this fix the issue with Docker?

CHOKIDAR_USEPOLLING=true npm start

@YAmikep
Copy link

YAmikep commented Nov 19, 2016

Using the env variable works for me.
There does not seem to be an env variable to set the interval though, correct?

@fson
Copy link
Contributor

fson commented Nov 19, 2016

It seems that an env variable for polling interval has been requested (paulmillr/chokidar#518) and the author has approved the idea, someone just needs to implement it 😃

@gaearon
Copy link
Contributor

gaearon commented Feb 11, 2017

Going to close as there is a path forward (described above) that is out of our control.

@jurosh
Copy link

jurosh commented Jan 26, 2018

Thanks @fson updating script to use CHOKIDAR_USEPOLLING=true react-scripts start helped. Maybe would be nice to put this to react-create-app docs - or just add there reference to webpack docs... what do you guys think? As for many it might be quite an issue to solve watchmode...

maxalbert pushed a commit to maxalbert/testdriven-io-course that referenced this issue May 27, 2018
@togakangaroo
Copy link

Hey, I might be being docker-stupid, but where is this supposed to code? I assumed that you would replace the command but that seems not to be the case?

c4lliope pushed a commit to uwcirg/tb-api that referenced this issue Sep 13, 2018
The app watches for file changes with the mechanism described at:
* facebook/create-react-app#1049
c4lliope pushed a commit to uwcirg/tb-api that referenced this issue Sep 24, 2018
The app watches for file changes with the mechanism described at:
* facebook/create-react-app#1049
c4lliope added a commit to uwcirg/tb-api that referenced this issue Sep 24, 2018
Add some development-mode configs for `client`

When uncommented, these configs will tell the app
to watch for file changes with the mechanism described at:
* facebook/create-react-app#1049
@airtonix
Copy link

you know, if all these nodejs people writing cli apps used nconf.env().argv() we'd be able to set configuration through environment variables or command line arguments.

@facebook facebook locked as spam and limited conversation to collaborators Oct 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants