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

Documentation lacks server.hmr.server config parameter #3587

Closed
6 tasks done
JBusillo opened this issue May 29, 2021 · 3 comments · Fixed by #3590
Closed
6 tasks done

Documentation lacks server.hmr.server config parameter #3587

JBusillo opened this issue May 29, 2021 · 3 comments · Fixed by #3590
Labels
documentation Improvements or additions to documentation

Comments

@JBusillo
Copy link
Contributor

JBusillo commented May 29, 2021

Describe the bug

The documentation for server.hmr configuration specifies the following options: boolean | { protocol?: string, host?: string, port?: number, path?: string, timeout?: number, overlay?: boolean } It appears to lack the server?: Server option.

Is this option internal to Vite, or is it intended to be used as explained below? If intended for public use, perhaps the documentation could explain its usage.

In vite/src/node/server/ws.ts, there is a reference to the hmr.server option. When Vite runs in middlewareMode, the server object can be passed via this option (in this case, SvelteKit). This allows a secure web socket connection,which uses https:// for certificate validation, to 'piggyback' onto the specified server.

This option is useful for of self-signed certificates -- The acceptance of the certificate will allow both https// and wss:// connections to proceed.

Reproduction

No repo. Documentation only.

System Info

System:
    OS: Linux 5.8 Ubuntu 20.04.2 LTS (Focal Fossa)
    CPU: (6) x64 Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
    Memory: 24.35 GB / 31.04 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 14.17.0 - /usr/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.12.0 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 90.1.24.85
    Chrome: 90.0.4430.212
    Firefox: 88.0.1

Used package manager: Not applicable

Logs

Not Applicable

Before submitting the issue, please make sure you do the following

@patak-dev
Copy link
Member

config.server.hmr.server is part of the public API, but it is undocumented as you pointed out. This is the PR that added the option #2338. @JBusillo would you like to create a PR to add this to https://vitejs.dev/config/#server-options?

@patak-dev patak-dev added documentation Improvements or additions to documentation and removed pending triage labels May 29, 2021
@JBusillo
Copy link
Contributor Author

Yes, I'd be glad to create the PR. I'll also add a short description of the option. Thanks for the prompt reply!

@antfu antfu closed this as completed in a30724c May 30, 2021
ygj6 pushed a commit to ygj6/vite that referenced this issue Jun 1, 2021
* docs(hmr): document hmr.server option

* docs(hmr): hmr.server apply suggestions
@github-actions
Copy link

This issue has been locked since it has been closed for more than 14 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants