The problem with the above config is that each time I edit a code file outside templates, views or live I need to manually restart the server, and this is so annoying and prone to forget, thus leading to debugging an error that doesn’t exist, aka I just forgot to restart the server… or am I missing something?
The live reload config you see here is about which files should, immediately on save, automatically trigger the page itself to reload.
It’s the code_reloader that handles recompiling your core Elixir code on page refresh. I ran a new copy of phoenix and saw the following in endpoint.ex:
# Code reloading can be explicitly enabled under the
# :code_reloader configuration of your endpoint.
if code_reloading? do
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
One potential issue here is what happens if you have a GenServer that assumes state in a certain format, then you change it, it reloads the code, and the old genserver state is now erroneous.
This is just speculation on my part, but I’m assuming that this is why the default is the way it is. The files that Phoenix owns are known to be safe, but your application cannot be known to be safe. Beginners may get even more confused by not knowing why things are broken.