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

Cannot use hot reloading in Docker (continuation of #6722) #8306

Closed
6 of 7 tasks
dirslashls opened this issue Nov 9, 2022 · 1 comment · Fixed by #8342
Closed
6 of 7 tasks

Cannot use hot reloading in Docker (continuation of #6722) #8306

dirslashls opened this issue Nov 9, 2022 · 1 comment · Fixed by #8342
Labels
bug An error in the Docusaurus core causing instability or issues with its execution good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin.

Comments

@dirslashls
Copy link
Contributor

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

Issue #6722 has been fixed by passing the --poll CLI option as a watch option to WebPack. However, webpack expects the value to be passed either as a number or boolean. As a result, the cli option which ends up passing as a string errors out.

Just simply trying

docusaurus start --poll 1000

gives the following error

[ERROR] ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.watchOptions.poll should be one of these:
   number | boolean
   -> Enable polling mode for watching.
   Details:
    * configuration.watchOptions.poll should be a number.
      -> `number`: use polling with specified interval.
    * configuration.watchOptions.poll should be a boolean.
      -> `true`: use polling.

Reproducible demo

No response

Steps to reproduce

Locally run the following and see the error

docusaurus start --poll 1000

Expected behavior

Ideally the watching should take effect by polling.

Actual behavior

The server doesn't start and errors out.

See webpack/webpack#3048 which mentions similar issue of passing the option via env variable which is treated as a string.

Your environment

No response

Self-service

  • I'd be willing to fix this bug myself.
@dirslashls dirslashls added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Nov 9, 2022
@slorber slorber added good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. status: needs triage This issue has not been triaged by maintainers and removed status: needs triage This issue has not been triaged by maintainers labels Nov 9, 2022
@slorber
Copy link
Collaborator

slorber commented Nov 9, 2022

Thanks, can reproduce 👍

Likely a tiny parsing issue before we apply the validation.


Good first issue for an external contributor - please send a PR directly with a fix, don't claim the issue

@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Nov 9, 2022
mhnaeem added a commit to mhnaeem/docusaurus that referenced this issue Nov 15, 2022
This change normalizes input for the poll option to either a boolean or number to meet the specs required by Webpack config

fixes facebook#8306
mhnaeem added a commit to mhnaeem/docusaurus that referenced this issue Nov 16, 2022
This change normalizes input for the poll option to either a boolean or number to meet the specs required by Webpack config.
Move the function into the docusaurus.mjs file as requested.

fixes facebook#8306
slorber pushed a commit that referenced this issue Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants