Skip to content

How can I make HMR work with docker compose? #33

Answered by ElMassimo
franciscoj asked this question in Q&A
Discussion options

You must be logged in to vote

Hi there!

Forked your example, please take a look at https://github.com/ElMassimo/vite_rails_docker_example.

The missing piece is setting VITE_RUBY_HOST to 0.0.0.0 in the Vite service, so that the process can receive external requests.
Otherwise, the service will not be reachable by the Rails service.

Setting hmr.host to vite causes a browser running in the host to attempt communicating with http://vite:3036, which does not exist. Removing the hmr option from vite.config.ts does the trick.

I don't use Docker in development, someone else might be able to provide a better setup 😃

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@franciscoj
Comment options

@ElMassimo
Comment options

Answer selected by franciscoj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants