railsjazz / rails_live_reload

Live Reload for your Rails app. The easiest way to increase your productivity.
https://www.railsjazz.com/
MIT License
318 stars 8 forks source link

Problems with longer asset compilation times #34

Open neontuna opened 5 months ago

neontuna commented 5 months ago

Using Rails 7, jsbundling-rails and webpack we're having some issues with rails_live_reload triggering the reload before asset compilation finishes.

This is covered in the readme

...but in case your asset compilation takes couple of seconds, this might not work propperly, in that case we would recommend you to add configuration to watch output folder.

Which I've done

config.watch %r{app/views/.+\.(erb|haml|slim)$}
config.watch %r{app/assets/builds/.+\.(css|js|html|png|jpg|ts|jsx)$}, reload: :always

The problem is - it still seems like reload is occurring before compilation is actually done. Every other reload we see errors like the following

image

Forcing a refresh fixes it.

I was thinking maybe allowing for a static delay in config (after detecting change but before reload) might be a good solution.