DEV Community

Sushant Bajracharya
Sushant Bajracharya

Posted on

Understanding "warning: redefining module x" in elixir

Take this article with a grain of salt.

This particular warning is telling you that even after loading the module, elixir is trying to recompile it.

There are different ways to clear such warning in the internet like removing the _build directory. It did not work for me initially.

In my case, I had an unused variable in my eex file. Since my project was configured to treat warnings as error in my credo setting, it failed to compile leaving me with a lot of "redifing module" warnings. And in that noise, another warning was hidden which pointed out on prefixing the unused variable.

After prefixing the unused variable and mix do clean, phx.server, those warnings went away

Discussion (0)