-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
fix(core): make webpack HMR always listen to current location #7951
Conversation
Hi @jeengbe! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the deploy preview of this PR
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Can you backup your claim with some reference to other projects using a similar setup? I'd rather align to the behavior others are already using if we were to merge something not easy to double-check is correct for everyone. For example CRA has env variables, but does not use such default: |
I cannot, I just can't come up with a situation in which the new behaviour would be unwanted. As the websocket runs on the same domain + port the rest of the website is on, it always ought to be accessible on the same domain + port. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not familiar with the dev server architecture at all, so more of a question: does this change the experience with remote developing, like on GitHub codespaces? Right now we have to recommend --host 0.0.0.0
.
It does change the experience in that it fixes HMR for when Docusaurus is launched on a different address/port is is being used with. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current configuration looks sensible to me (sounds like a no-op in most cases). I'll be willing to give it a try.
Let's try this and we'll see if anyone complains. So far it seems to work for me. For now I won't backport it in 2.x |
I for one would like to see this backported to 2.x! I brought up a question in discord that was likely solved by this PR. https://discord.com/channels/398180168688074762/867060369087922187/1012096405780844594 My use case is the same as #7912 -- it's that we want to run the docusaurus dev server on eg minikube locally. One of our requirements is to have TLS enabled in development for secure-context only JS features, like Problem is that when deployed behind a reverse proxy ingress, the HMR websocket tries (and fails) to connect to the internal port like |
@zevisert we could backport it but I'd prefer to have more user feedback first. For example, if nobody complains on any 3.0 upcoming alphas, it becomes safer to backport it |
1 similar comment
@zevisert we could backport it but I'd prefer to have more user feedback first. For example, if nobody complains on any 3.0 upcoming alphas, it becomes safer to backport it |
Until the backport fix is out, remember that you can always put PR diffs in your patches folder and run patch-package. https://patch-diff.githubusercontent.com/raw/facebook/docusaurus/pull/7951.diff |
I noticed this never made it to 2.2.0, why? |
because we don't have a lot of feedback on potential side-effects due to v3.0 canaries not being widely, and I decided to not backport this: If you want to use it, wait for 3.0, use a canary release, or this temp workaround: #7912 (comment) |
I am trying to use a 2.4 project in GitHub Codespaces, which sets up an HTTP proxy for port forwards, and this issue is a major disappointment/pain. One zero-side-effect option would be to allow the user to enable this with the CLI. Having the dev server listen on the same host/port as the original connection and the client component look for it there is exactly what Next.js has been doing for quite some time with no ill effect. IMO, the current configuration only works because of a side effect. |
Applying the change from this PR in my |
See #7912 for explanation as to how these changes fix the problem. This does not have any side effects that I am aware of.
Pre-flight checklist
Motivation
Test Plan
Test links
Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/
Related issues/PRs
Closes #7912