I am using a phoenix app which uses ex_gram library. It basically talks to telegram via HTTP.
When I change something in my bot.ex file (which has functions which make HTTP calls for me) , I cannot see the changes until I restart my phoenix server.
Sometimes, I stop and start the server and things work just fine.
On other occasions I run, rm -rf _build and then rebuild the entire project. (takes 4 minutes or so)
Is there a way to watch the changes in my bot.ex and file and recompile ONLY that file?
This should work automatically as Phoenix should recompile the project on requests. When this does not work, it is usually because there is another tool, like a mix watcher or similar, running in the background that is compiling the files behind the scenes, so Elixir don’t see them as stale.
It may also happen if your files are in a separate filesystem that does not track modification times correctly (such as network based ones).
In a default Phoenix app, changes to files in lib/my_app_web/(live|views)/.*(ex)$ & lib/my_app_web/templates/.*(eex)$ will trigger a live reload. Files under lib/my_app usually will not.
When I add or modify files outside of the two locations above, I just use recompile in iex to recompile the mix application