I just want to save a file and auto recompile, nothing more, no restarting, no plugs. We have an application that is just normal elixir without phoenix or live view or external assets. This may be answered somewhere, but I cannot find it anywhere because there are so many posts about live reloading not working in the contexts of these other projects.
We’ve been using for years a program we wrote ourselves, rl | Hex which is notable by how incredibly bad it is. If you have multiple nodes up clustered they both recompile and fight each other. Sometimes I wake up in the morning and my cpu is at 100% because it is just spinning for no good reason. Rarely it just stops working entirely until I restart it.
I tried phoenix_code_reloader, but looking at it, I can’t see where it actually recompiles anything and indeed it doesn’t seem to do anything without additional configuration involving endpoints that don’t exist in my project.
Yeah Phoenix.CodeReloader is a little hard to follow. The actual compilation happens on line 307 of Phoenix.CodeReloader.Server (and is tied to phoenix configuration):
When I want to recompile my code on any changes I use exsync (I’m also a maintainer):
One great benefit of exsync is that if you use path: dependencies then they’ll automatically be recompiled for you with no additional configuration needed (with phoenix you need to manually set :reloadable_apps).