changing a file like a_controller.ex leads to recompiles with other files which have
Endpoint.broadcast in it.
I just want the file to rebuild i make a change to. Is this possible? I know sometimes it is useful but i don´t see the point with
There are quite a few points to how elixir determines what to recompile. The important bit is that macros create compile time dependencies between modules, which are the reason for one change potentially propagating to recompiling many other modules.
For all the details I’d suggest:
Hard to say without knowing your code, but elixir will always recompile as less as possible but as much as necessary to have all resulting modules updated.
And if your other files have transitiv compile time dependencies on that changed file, then all of them get recompiled.
You can use
mix xref to learn more about interdependencies in your source code.
Thanks. I understand how it works. But not what i can do against it. It only comes down to the existence of
Endpoint.broadcast in a controller file. For example: I have 10 controller files with
Endpoint.broadcast in it. Now i change file 11 and all 11 files are recompiled.
The moment i remove
Endpoint.broadcast only file 11 is recompiled. I´m not sure what phoenix expects me to do. I can´t remove
Endpoint.broadcast in the other files but also don´t want to wait till all files are recompiled.