Skip to content

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

Closed

Description

@spaugh

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.

Activity

  1. fson commented on Nov 16, 2016

    @fson
    Contributor

    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.

  2. YAmikep commented on Nov 19, 2016

    @YAmikep

    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.

  3. fson commented on Nov 19, 2016

    @fson
    Contributor

    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
    
  4. YAmikep commented on Nov 19, 2016

    @YAmikep

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

  5. fson commented on Nov 19, 2016

    @fson
    Contributor

    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 😃

  6. gaearon commented on Feb 11, 2017

    @gaearon
    Contributor

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

  7. jurosh commented on Jan 26, 2018

    @jurosh

    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...

  8. togakangaroo commented on Aug 11, 2018

    @togakangaroo

    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?

  9. airtonix commented on Oct 13, 2018

    @airtonix

    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.

  10. locked as spam and limited conversation to collaborators on Oct 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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