Hot update `iex -S mix`

Hi, is there a way that if I update a file, that update can automatically be available in the iex -S mix console?

Because right now, everytime, I update a function, I have to close the console, and start it again to make the chances available.

You can use the recompile/1 helper https://hexdocs.pm/iex/IEx.Helpers.html#recompile/1

2 Likes

type in iex console:
r ModuleName
it recompiles and reloads module ModuleName and all dependent modules.

1 Like

Thanks @sneako and @japplegame!

If you create a new .ex file you’ll need to compile it first using c.

iex> c "lib/path/to/module_name.ex"

Then you can use iex> r ModuleName to reload it after edits. You only need to use c for any newly added .ex files.

1 Like