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

Setting "0.0.0.0" for host configuration in config/vite.json is not working correctly #179

Closed
vtt opened this issue Jan 17, 2022 · 3 comments

Comments

@vtt
Copy link

vtt commented Jan 17, 2022

Description 📖

When specifying "0.0.0.0" as host in config/vite.json, HMR is not working correctly.
config/vite.json

{
  "all": {
    "sourceCodeDir": "app/frontend",
    "watchAdditionalPaths": []
  },
  "development": {
    "autoBuild": true,
    "host": "0.0.0.0",
    "publicOutputDir": "vite_dev",
    "port": 3036
  },
  "test": {
    "autoBuild": true,
    "publicOutputDir": "vite_test",
    "port": 3037
  }
}

Running bin/vite dev, it shows:

vite v2.7.12 dev server running at:

  > Local:    http://localhost:3036/vite_dev/
  > Network:  http://192.168.0.4:3036/vite_dev/

  ready in 467ms.

Under Chrome console, it shows:

[vite] connecting...
client.ts:28 WebSocket connection to 'ws://0.0.0.0:3036/vite_dev/' failed: 
(anonymous) @ client.ts:28
client.ts:222 [vite] server connection lost. polling for restart...

Note that it uses "0.0.0.0" as the address but not the correct IP for the network 192.168.0.4

@vtt vtt added the bug: pending triage Something doesn't seem to be working, but hasn't been verified label Jan 17, 2022
@vtt vtt changed the title Setting 0.0.0.0' for host configuration in config/vite.json is not working correctly Setting "0.0.0.0" for host configuration in config/vite.json is not working correctly Jan 17, 2022
@ElMassimo
Copy link
Owner

ElMassimo commented Jan 17, 2022

Hi Tin!

See #119 (comment) and leave your feedback, to consider reverting that behavior.

In the meantime, you can configure server.hmr.host explicitly invite.config.ts.

@ElMassimo ElMassimo added bug: regression and removed bug: pending triage Something doesn't seem to be working, but hasn't been verified labels Jan 17, 2022
@ElMassimo
Copy link
Owner

Released vite-plugin-ruby@3.0.8 including this fix.

@wizztjh
Copy link

wizztjh commented Oct 11, 2022

I'm still having this issue in Vite v3.1.7

VITE v3.1.7  ready in 1269 ms
hyonline_internal-web-1  | 07:05:30 vite.1 |
hyonline_internal-web-1  | 07:05:30 vite.1 |   ➜  Local:   http://localhost:3036/vite/
hyonline_internal-web-1  | 07:05:30 vite.1 |   ➜  Network: http://172.18.0.3:3036/vite/

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants