I build a mix task under lib/mix/tasks\example , which require a module under lib\example, like this
This task runs under :dev env smoothly, but when in :prod env, I always get a function Example.Elasticsearch.clear_all/0 is undefined (module Example.Elasticsearch is not available).
I think this has something to do with Example.Elasticsearch is not compiled when you call the task in production mode.
could you delete the _build folder to remove the current build, then run mix compile in both dev and production enviroment and check that the Example.Elasticsearch is compiled. I think by doing this will allow us to replicate Example.Elasticsearch not compile from prod mode into dev mode so we can see what went wrong.