Elixir recompiles on every mix invocation


On almost every invocation of any mix command, Elixir has to recompile basically my entire application and all dependencies. Even if I don’t change any code but simply save an existing file, the entire thing has to be rebuilt again.

I’m working in Docker to run Elixir, with the pertinent parts of the docker-compose.yaml file below.

      - source: .

        target: /usr/local/src/app

        type: bind

Does anyone know what might be causing this to recompile every time? I’m a new member of a team of Elixir programmers and no one else has had this issue :\ - Any hints appreciated :slight_smile:

Is there anything in your config files that might trigger a recompilation? Something that can change on every compile, like a time read, a random number, an ENV read that can change.

Also, are you sure it’s a full recompilation, not mostly full? Do a mix compile --force and check if the number of files matches with what you observe.

Also, do you build/run outside of container too? That might cause it too.

Most likely circular compile-time dependencies between modules. Take look at this article - Speeding up re-compilation of Elixir projects - Dashbit Blog

there will be some improvements in the next release, see #060 Compile Faster with Marc-André Lafortune - Thinking Elixir