ElMassimo / vite_ruby

⚡️ Vite.js in Ruby, bringing joy to your JavaScript experience
https://vite-ruby.netlify.app/
MIT License
1.28k stars 117 forks source link

How can I enable HMR to function with subdomains? #461

Closed guillaumebriday closed 3 months ago

guillaumebriday commented 3 months ago

Description 📖

I tried many different configuration (like "host": "0.0.0.0"), but HMR still does not work for me with subdomains. I tried to configure the host: https://vite-ruby.netlify.app/config/#host but it does not work.

I use multiple tenant based on subdomain like so: http://client-a.concilia.localhost:3000, http://client-b.concilia.localhost:3000, etc

I would like HMR to work for any subdomain, is it possible?

I have these errors in the console once I run VITE_RUBY_HOST=0.0.0.0 yarn vite and reload the page Screenshot 2024-05-15 at 17 12 09

I also found this issue https://github.com/ElMassimo/vite_ruby/issues/179 but it does not fix my problem

Any idea how to fix that?

Thank you in advance!

guillaumebriday commented 3 months ago

Ok I found the problem. It's not related to Vite_ruby directly.

It was because I use thewebmock gem that override the StubSocket https://github.com/bblimke/webmock/blob/master/lib/webmock/http_lib_adapters/net_http.rb#L210 and it's not compatible with Vite ruby