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

feat(v2): add CLI option for polling #2630

Merged
merged 3 commits into from
Apr 20, 2020
Merged

feat(v2): add CLI option for polling #2630

merged 3 commits into from
Apr 20, 2020

Conversation

TomBrien
Copy link
Contributor

Motivation

I've been working with a project that likes to have repos contain VS Code devcontainers so that you can simply open the repo in VS code, load up a configured Docker container and away you go. I have this working 99 % with our Docusaurus 2 repos but live reloading does not work use the fsevents and inotify methods used to watch for file changes in this case. Webpack Dev Server provides a polling alternative option for this and it is noted that this is recommended for such environments.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

  • Run this repository following the standard instruction set here.
  • Build the website with standard yarn start to check works with no flag provide. Make some minor edits and check there is an instant reload. It does ✔
  • Build the website with yarn start --poll which uses the newly add --poll option to set watchOptions.poll to true. Make some minor edits and see a reload after a small delay from the 1 s polling time. It does ✔

Related PRs

Docs are (I think) updated correctly. I could not quite ascertain the convention for adding to the changelog so I'm guessing that that is done at release?

Some environments (specifically docker containers) can have issues with file watching for live reloads. [Webpack Dev Server provides a polling alternative](https://webpack.js.org/configuration/watch/#watchoptionspoll) option for this
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Apr 19, 2020
@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Apr 19, 2020

Deploy preview for docusaurus-2 ready!

Built with commit ddb7e51

https://deploy-preview-2630--docusaurus-2.netlify.app

@TomBrien TomBrien changed the title Add CLI option to polling Add CLI option for polling Apr 19, 2020
Copy link
Contributor

@lex111 lex111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I did not know about this feature VS Code, I'm fine with it (only one typo needs to be fixed).

.action((siteDir = '.', {port, host, hotOnly, open}) => {
.option(
'--poll',
'Use polling rather than wathcing for reload (default: false)',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: wathcing -> watching

@lex111 lex111 added the pr: new feature This PR adds a new API or behavior. label Apr 20, 2020
@lex111 lex111 added this to the v2.0.0-alpha.51 milestone Apr 20, 2020
@lex111 lex111 changed the title Add CLI option for polling feat(v2): add CLI option for polling Apr 20, 2020
@yangshun yangshun merged commit 852b5e8 into facebook:master Apr 20, 2020
@TomBrien
Copy link
Contributor Author

Cheers, sorry for the typos. The remote-containers are really cool when you have a slightly complicated project and want people to be able to just pick up and go like GitPod but local I guess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants